Esempio n. 1
0
        public GameObjectPool AddPool(string poolName, GameObject prefeb, int maxCount, int initCount)
        {
            if (m_PoolMap.ContainsKey(poolName))
            {
                Log.w("Add Same pool");
            }

            GameObjectPool pool = new GameObjectPool();

            pool.InitPool(transform, poolName, prefeb, maxCount, initCount);
            m_PoolMap.Add(poolName, pool);
            return(pool);
        }
Esempio n. 2
0
 public void AddPool(string poolName, GameObject prefab, int initCount, Transform transform = default)
 {
     if (m_PoolMap.ContainsKey(poolName))
     {
         Log.w("#Already Init GameObjectPool:" + poolName);
         return;
     }
     GameObjectPool pool = new GameObjectPool();
     if (transform == default)
     {
         transform = this.transform;
     }
     pool.InitPool(poolName, transform, prefab, initCount);
     // GameObject poolObj = new GameObject();
     // poolObj.transform.SetParent(transform);
     // var pool = poolObj.AddComponent<GameObjectPool>();
     // poolObj.name = poolName;
     // pool.m_PoolName = poolName;
     // pool.m_Prefab = prefab;
     // pool.m_InitialSize = initCount;
     m_PoolMap.Add(poolName, pool);
 }