this.GetChildCount() return 0, when there is one child

Godot Version

4.2.1.stable.mono

Question

Hi, I’m new to Godot so I’m not sure what I’m doing wrong.
I have two timers in a scene - one main timer (“mainTimer”) and a child timer (“childTimer”).
When i try to access the the childTimer with this.GetNode("childTimer");

I Get “Node not found: “childTimer” (relative to “Timer”).”

Also this.GetChildCount() returns 0.

My scene SS:

I noticed i had a typo in " this.GetNode("childTimer")". the issue still exists event after I fixed it.

GetNode is not a godot function, but get_node is…
Post your actual code.

This C# not GDScript.

This is how I use these methods in _Ready() method

var node = this.GetNode("ChildTimer");
GD.Print(this.GetChildCount());

Also I use AutoLoad for this scene

My mistake, I added script file to path in autoload.
script does not load children.

Once I changed to .tscn file it was fixed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.