Esempio n. 1
0
        public void AddItem(T item, bool deactivate = true)
        {
            if (!pool.HasRoom)
            {
                if (!allowExpansion)
                {
                    return;
                }

                pool.Resize(pool.Capacity * 2);
                Debug.Log($"[GameObjectPool::AddItem]: Pool Resized to {pool.Capacity}");
            }

            trackedObjects++;
            pool.Push(item);

            if (!deactivate)
            {
                return;
            }

            var go = item.gameObject;

            if (go.activeSelf)
            {
                go.SetActive(false);
            }
        }