Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | kinori |
I preloaded my custom scene, right after instantiating it by code, I tried to set the properties of its instance. There's no problem if I just set the root node's properties.However, if I tend to set the child's node properties, it would not working and give me an error. After debugging, I made the assumption that I had problem with getting the referrence of the child node. Because I use "onready" to get the child node. It's before the root node go to ready stage that I try to set the properties. My ref would be null. So I tried to use *_defferd() function. It worked. But I wonder, is there a more elegant way to deal with this. Can I just get child node's referrence in a early stage.
I do not konw when the child node is instantiated. Or maybe the child node’s instance has not been created at all when I try to access it.