universalGameObject pool


Simple pool with a unity like signature of methods. Simplest use. Quick implementation.


by Pavel Teslenko


Price History +

How to use:


1. Add:


using GameObjectPooling;


2. Insert the GameObjectPool. before calling the Instantiate and Destroy methods:


Examples:

GameObjectPool.Instantiate(prefab, position, Quaternion.identity);

Rigidbody instance = GameObjectPool.Instantiate<Rigidbody>(prefab, parent);

GameObjectPool.Destroy(anyGameObject);


3. If necessary, reset variables in components after instance reuse:


Rigidbody instance = GameObjectPool.Instantiate(prefab, position, Quaternion.identity);

instance.velocity = Vector3.zero;