Tkap1

Untitled

Jul 6th, 2021 (edited)
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # THIS:
  2. onready var foo = $Foo
  3.  
  4. # IS THE SAME AS:
  5. var foo
  6. func _ready():
  7.     foo = $Foo
  8.  
  9. # IS THE SAME AS:
  10. onready var foo = get_node("Foo")
  11.  
  12. # IS THE SAME AS:
  13. var foo
  14. func _ready():
  15.     foo = get_node("Foo")
  16.  
  17.  
  18. # You could not do any of that and everytime you want to access "Foo" do:
  19. $Foo.some_func()
  20.  
  21. # But then if "Foo" is not in the same location, for example you move it into $YSort/Foo,
  22. # now you would have to change every line that uses "Foo" to $YSort/Foo
Add Comment
Please, Sign In to add comment