void InitPool() { UniLog.CCAssert(m_availabilityElements.Count == 0, "Can not initialized pool, because this pool is not empty"); UniLog.CCAssert(m_prefab != null, "Found error when initialize pool, case by prefab is null"); if (m_availabilityElements == null) { m_availabilityElements = new List <UniPooledObject>(); } for (int i = 0; i < m_minCapacity; i++) { var obj = Instantiate(m_prefab, transform); obj.SetActive(false); UniPooledObject t = null; if (t = obj.GetComponent <UniPooledObject>()) { t.Pool = this; m_availabilityElements.Add(t); } } }
public void PushToPool() { UniLog.CCAssert(Pool != null, "Pool is not signed"); Pool.AddToPool(this); }