dollar_node_paths.gd 537 B

12345678910111213141516171819202122
  1. extends Node
  2. func test():
  3. # Create the required node structure.
  4. var hello = Node.new()
  5. hello.name = "Hello"
  6. @warning_ignore("unsafe_call_argument")
  7. add_child(hello)
  8. var world = Node.new()
  9. world.name = "World"
  10. @warning_ignore("unsafe_call_argument")
  11. hello.add_child(world)
  12. # All the ways of writing node paths below with the `$` operator are valid.
  13. # Results are assigned to variables to avoid warnings.
  14. var __ = $Hello
  15. __ = $"Hello"
  16. __ = $Hello/World
  17. __ = $"Hello/World"
  18. __ = $"Hello/.."
  19. __ = $"Hello/../Hello/World"