0 votes

what i want to do is ,when i instance node under (creation)node.
my instance node will look for var in first node in tree.
i dont want do like this get_node("character_selection") because i can only access in this scenes. there other way to do

get_tree(),get_root().get_node("character_selection")

enter image description here

in Engine by (384 points)

1 Answer

0 votes
onready var creation = $creation

func test():
  if creation.get_child(0).has_method("get_variable"): 
    print(creation.get_child(0).get_variable())  

func _ready():
 test()

parent.get_child(n) where n is the index of that parent's children.
Visit this for more detailed info https://docs.godotengine.org/en/stable/classes/class_node.html

by (334 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.