-
-
Notifications
You must be signed in to change notification settings - Fork 1
Object Pooling
John 'Snowdrama edited this page Feb 24, 2026
·
1 revision
The object pooler is not a scene object but a tool for automatically handling pooled objects.
private GameObjectPooler bullets;
public void Start()
{
//create a bunch of bullets and put it in the pool
}
//later...
var bullet = bullets.GetOne();
var bulletGroup = bullets.Get(5);The game object pooler relies on "Active" so any thing that should be in a pool should be deactivated not Destroyed
public class Bullet : MonoBehaviour{
public void OnTrigerEnter3D()
{
this.SetActive(false);
}
}There's also a non GameObject pooler for stuff like structs and non GameObjects, but that you need to return the object yourself.