My script does not recognize his children

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nitsuga

When I use get_node, get_child or $, it returns null.

It’s just that, I don’t know how to fix it. In case it works, his script is an auto load.

:bust_in_silhouette: Reply From: wombatstampede

You can autoload scenes or scripts.

If you autoload scripts, they usually don’t have child nodes. They’re just single nodes in the scene tree. You could add children programmatically but why?

Scenes usually consist of multiple nodes. In that content get_child() makes more sense.

That said: I guess that you know that many people here successfully use get_node or get_child. So you could derive that your problem is not very common. So how could you come to the conclusion that just your two sentences can help people narrowing down your problem?

If you need furthere help: Please define what you actually want to achieve and for what purpose you will use get_node or get_child. And give us some idea of the node tree (parent, children, where script is attached…)which you expect to exist.

:bust_in_silhouette: Reply From: Merlin1846

Don’t autoload scripts, they cant have children.