using ObjectPools; public sealed class TestObjectPool : Component { [Property] private GameObject prefab { get; set; } private ObjectPool<GameObject> _pool; protected override void OnStart() { _pool = new ObjectPool<GameObject>( OnCreate, OnGet, OnRelease, OnDestroy, defaultCapacity: 10, maxAmount: 10000, collectionCheck: true); } GameObject OnCreate() { return prefab.Clone(); } void OnGet(GameObject obj) { obj.Enabled = true; } void OnRelease(GameObject obj) { obj.Enabled = false; } void OnDestroy(GameObject obj) { obj.Destroy(); } }