get_node_without_onready.gd 432 B

123456789101112131415161718
  1. extends Node
  2. var add_node = do_add_node() # Hack to have one node on init and not fail at runtime.
  3. var shorthand = $Node
  4. var with_self = self.get_node(^"Node")
  5. var without_self = get_node(^"Node")
  6. var with_cast = get_node(^"Node") as Node
  7. var shorthand_with_cast = $Node as Node
  8. func test():
  9. print("warn")
  10. func do_add_node():
  11. var node = Node.new()
  12. node.name = "Node"
  13. @warning_ignore("unsafe_call_argument")
  14. add_child(node)