Godot Version
4.4.1
Question
I have three scenes, each one in it’s own subfolder… the scenes are A, B and C.
Scene A is derived from Sprite2d, it has a script attached
Scene B, which inherits from A and add a child control node (called “statusbar”)
Attached, there is a script that inherits from A, and in _ready uses get_node like this:
func _ready():
fuel_ind_node = get_node("statusbar")
Scene C, which inherits from B setting a specific image to the Sprite texture.
C doesn’t attach any script, as it’s not needed.
Upon startup, i get a crash because:
E 0:00:03:593 B_scene.gd:11 @ _ready(): Node not found: "statusbar" (relative to "/root/scenec/C").
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1877 @ get_node()
<Stack Trace> B_scene.gd:11 @ _ready()
[ ... omitted irrilevant stack trace ... ]
What i am missing here?
Of course the B_scene script is called, because C inherits from B. But why get_node does return null? In th editor, i can auto-complete “statusbar” too, when i open scene B script.