示例#1
0
 private void MakePool(int length, Transform parent)
 {
     m_Pool = new List <PoolableObject>();
     for (int i = 0; i < length; i++)
     {
         PoolableObject _poolableObject = null;
         if (parent == null)
         {
             _poolableObject = Instantiate(m_Prefab).GetComponent <PoolableObject>();   //Getcompent poolableobject;
         }
         else
         {
             _poolableObject = Instantiate(m_Prefab, parent).GetComponent <PoolableObject>();
         }
         _poolableObject.Load();
         _poolableObject.HideOjbect();                                                            //Pool the object;
         m_Pool.Add(_poolableObject);                                                             //Add to the list;
     }
 }