public static Pool GetPool(PooledMonoBehaviour prefab) { if (Pools.ContainsKey(prefab)) { return(Pools[prefab]); } var pool = new GameObject("Pool-" + prefab.name).AddComponent <Pool>(); pool._prefab = prefab; Pools.Add(prefab, pool); return(pool); }
private void AddObjectToAvailableQueue(PooledMonoBehaviour pooledObject) { pooledObject.transform.SetParent(transform); _objects.Enqueue(pooledObject); }