Ejemplo n.º 1
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);
 }