Example #1
0
 public bool Unspawn(GameObject obj)
 {
     if (activeList.Contains(obj))
     {
         obj.transform.parent = ObjectPoolManager.GetOPMTransform();
         activeList.Remove(obj);
         inactiveList.Add(obj);
         obj.SetActive(false);
         return(true);
     }
     return(false);
 }
Example #2
0
        public void MatchObjectCount(int count)
        {
            if (count > cap)
            {
                return;
            }
            int currentCount = GetTotalObjectCount();

            for (int i = currentCount; i < count; i++)
            {
                GameObject obj = (GameObject)MonoBehaviour.Instantiate(prefab);
                obj.SetActive(false);
                obj.transform.parent = ObjectPoolManager.GetOPMTransform();
                inactiveList.Add(obj);
            }
        }