Reply To: Any tips for object pooling?

NodeCanvas Forums General Discussion Any tips for object pooling? Reply To: Any tips for object pooling?


Hello there,

AsyncLoad option itself is very good to instantiate / initialize graph owner objects even without pooling sometimes since most initialization is happening on a separate thread.

As for typical pooling, you can pre-instantiate all your graph owner objects at the start of the game/scene so that they all initialize at that time. Remember to set the “On Enable” parameter on the graph owner inspector to “Do Nothing” so that the graph owner does not “Start Behaviour” automatically. Then when the time comes that you need that pre-instantiated graph owner, you can simply call owner.StartBehaviour() from code.

The relationship between AsyncLoad, activeInHierarchy, and pooling, is because some people prefer to instantiate the graph owner objects (with AsyncLoad enabled ) and immediately deactivate them instead. Then activate them when they are needed in the game. This will result in the same thing as above, but I recommend using the first way described above instead.

Let me know if this helps.


Join us on Discord: