Publisher | Pavel Teslenko |
---|---|
File size | 61.70kB |
Number of files | 7 |
Latest version | 1 |
Latest release date | 2024-10-11 07:41:15 |
First release date | 2024-10-11 07:41:15 |
Supported Unity versions | 2018.4.2 or higher |
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;