Daniel Lyons' Notes

Godot 4 Tutorial - Exportable Node Paths

Description

Learn how to leverage the NodePath class to create unbreakable Unity-style object references in Godot.Godot NodePath documentation:https://docs.godotengine.o...

My Notes

See also

NodePath Examples

get_node("path/to/your/node")
$"path/to/your/node"

00:41: Godot converts your string into a NodePath class:
So $"Game World/Player" becomes NodePath("Game World/Player")

Auto-Updating NodePaths

  • 00:55: NodePaths do not auto update.
    • They point to a location where a node is.
    • However if that node moves, the NodePath won't be updated and now it is a broken reference.
  • 01:27: In the editor, NodePaths are automatically updated, but they are never updated at runtime.
@export var ui: NodePath
# this NodePath will auto update when a change is made in the editor. 
Godot 4 Tutorial - Exportable Node Paths
Interactive graph
On this page
Description
My Notes
See also
NodePath Examples
Auto-Updating NodePaths