I have a persistent node that is used for all scenes in my project.
I would like this persistent node to run functions each time a new scene is loaded.
How to detect a new scene is loaded ? I searched around couldn’t find something like a on scene loaded listener.
The solution I have is for each of the scene, use a script to find this persistent node and when this node is found, run the functions from persistent node. Is there a function that the engine provides for this?
Just an additional info regarding to ‘on’, If you use it right before every scene change, just make sure you only call that function once, or turn it off right after use.
If you bind this every time you change to a new scene, it will newly register the callback, which adds up more functions to trigger by that event. This means previous callback will be called again and most often provide duplicated/undesired result and also a memory leak.