Hi all! I ran into a problem when developing abilities for a character. There are buttons on the stage, when pressed, a script attached to the resource that is attached to the button is triggered))))).
When I try to access the player’s child nodes, it throws an error that the node was not found, and the list of child nodes is empty, but if I call it as usual, everything happens normally.
How can this problem be solved? Is there an analogy that can be used to implement this?
Try to inspect what happened in game, to do this first run the game, minimize it (do not stop) so now you can see a option “remote” in the top of the scene tree, press it, there you can inspect what happening in game
The problem is that when passing a player through a method to a resource, it becomes impossible to call child nodes in the resource, the compiler throws an error - Node not found. I noticed that this error only occurs in resources, most likely this is due to the fact that the resource is not inherited from the Node class
You needed save player reference on resource or call method with player as parameter , resource are save in the file system not in the tree, not all resources are scripts like image, sounds just have import configurations.