0 votes

i instanced a scene into my main scene and i want it to access the parent node my main scene with my instanced scene.
How can i do that

in Engine by (397 points)

1 Answer

+1 vote

You can use get_parent() for this.

However, note that this will cause a problem if you run the scene by itself, because it won't have a parent. For that reason, it's usually a good idea to avoid referencing a parent and use signals instead when you need to communicate "up" the tree. But that's another topic... :)

by (20,917 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 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 webmaster@godotengine.org with your username.