I’ve a confusion within the strategy that we observe to make the sport basically, like if we’ve got 5 nodes in a scene and we’re making 4 nodes inactive and 1 energetic that’s wanted (likewise for all of the nodes), or eradicating the kids and including them to the container each time we’re going to want them again.
I see that you’re confused in regards to the efficiency of two options.
Efficiency by eradicating and re-adding nodes and efficiency by activating or deactivating nodes
- The time consuming manner so as to add nodes is when addChild is added to the scene. Activating/deactivating a node takes time when node.energetic iterates by and refreshes all of the states of the node.
- Each of those strategies are time consuming.
One really useful manner is to make the specified node a resident node (not an engine resident node, however a node that isn’t faraway from the node tree) and later transfer it into the scene when it must be rendered. When not wanted for rendering, transfer out of the scene.
Are you able to please elaborate on this with a small instance? it’s fascinating additionally I’m not getting what’s resident node precisely is.
For instance you are able to do the next :
If we are saying you created a button than adjustments the menu state fron inactive to energetic … as a substitute of doing so you are able to do the next :
1.Make the menu energetic and set it place to exterior of the scene
2.When clicking on the button you modify the menu place to the specified place contained in the scene
I hope that helped :))