This pooling system provides a decent solution to the problem of runtime memory allocations for GameObjects and Prefabs, but, as a quick reminder, we need to be aware of the following caveats:
- We need to be careful about properly resetting important data in respawned objects (such as Rigidbody velocity)
- We must ensure that we don't prespawn too few, or too many, instances of a Prefab
- We should be careful of the order of execution of Spawned() and Despawned() methods on IPoolableComponent and not assume that they will be called in a particular order
- We must call Reset() on PrefabPoolingSystem when loading a new scene to clear any null references to objects, which may no longer exist
There are several other features ...