This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+2 votes

gettree().geteditedsceneroot().getnode(pathto_node) seems not to work!

in Engine by (56 points)
Can you give some more information about your project? Do you want to create a custom node that adds a node to its parent? Just create the object `var foo =` and then add it whereever you want it in the tree with `add_child()`. `get_node()` does not add a node it gets an existing node.
I want to make a plugin in editor that add a child node in the edited scene. I guess there are two trees, one for the editor and one for the edited scene but I can't access this one.

1 Answer

+1 vote
var root =  get_tree().get_edited_scene_root()
var newSpriteNode =
by (699 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.