Exemple #1
0
        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);
        }
Exemple #2
0
 private void AddObjectToAvailableQueue(PooledMonoBehaviour pooledObject)
 {
     pooledObject.transform.SetParent(transform);
     _objects.Enqueue(pooledObject);
 }