Object pooling is where you pre-instantiate all the objects you'll need at any specific moment before gameplay — for instance, during a loading screen. Instead of creating new objects and destroying old ones during gameplay, your game reuses objects from a “pool”.
The Pool Manager allows you to toggle between a collection of pools and contains a lot of useful innovations such as load balancer, a scriptableObject database and separate settings for each pool.
It’s highly suggested to switch to the optimized despawn in code:
Despawn(Transform obj, Transform objTemplate) – it will significantly increase the despawn productivity. Moreover, the more prefabs, the greater the gain.
For example, if there were about 300 prefabs, 200 objects each – than a regular despawn would have taken a significant time to skim through all spawned objects. But thanks to the advanced despawn it will only go through the ones of the same type as objTemplate. So, the total gain is getting close to about 300 times faster!
The changes are serialized within a database under the Assets/Resources/F3DPoolManagerCache/ ; hence a separate set of pools per level, as well as a project, is possible by design. Creating a database is easy: type the database name and click “Create Database”
Next to the Database is a popup list which will toggle between the available pools. Click the “Create Pool” button to add one beforehand. Each pool contains the options affecting the designated prefab set, hence allowing as much of abstraction and control:
Initial parenting – Will parent all prefab instances to the Pool game object upon initialization
Runtime sorting – Will parent a particular prefab instance to the Pool game object upon despawn to ensure its returned to its original parent to prevent the direct use of the SetParent which affects performance significantly
Broadcasting – Calls the specified method name for every spawn and despawn event on the certain game object or any of its children.
Load control – The pool will limit the number of objects instantiated according to the maximum amount specified per frame
Load balancer – Toggling the option will try to keep the target FPS through limiting the quantity of instantiated objects per frame dynamically
Debug – Shows details about the results of running internal commands. It can be especially useful when a verbose console output is required.
Prefab items – total quantity of prefabs in the pool
Base – The minimum number of a particular instances created during the initialization
Max – The maximum amount of a particular instances allowed in the scene. The pool will ignore any further spawn requests above this value.