PoolSystem
This class provides static methods for getting gameobjects and returning them back to pool.
Instance pooling is very good practice to squeeze better performance in case if you need to spawn objects frequently (like projectiles in shooter game or something like this).
Available methods
This method clears all created pools.
This method returns an instance of class T which is inherited from MonoBehaviour and IPooledObject, and presented by certain prefab. It tries to get such object from pool with assigned name, in case if such pool isn't found, it creates new pool with this name.
Example:
This method returns an available instance of class T which is inherited from MonoBehaviour and IPooledObject, and contained in pool with name.
Example:
This method returns gameobject obj of given type T to pool. This gameobject will be immediately deactivated after this.
Example:
This method returns an available instance of given prefab from pool with name, moves this instance to given world position and sets certain parent transform. If parent is null, it leaves instance in previously assigned parent transform.
Example:
This method returns an available instance of given prefab from pool with name, moves this instance to given world position, rotation and sets certain parent transform. If parent is null, it leaves instance in previously assigned parent transform.
Example:
Last updated