public QGOPool CreatePool(string poolName, int initSize, int maxSize, GameObject prefab) { var pool = new QGOPool(poolName, prefab, initSize, maxSize, PoolRootObject); m_GameObjectPools[poolName] = pool; return(pool); }
public void Release(string poolName, GameObject go) { if (m_GameObjectPools.ContainsKey(poolName)) { QGOPool pool = m_GameObjectPools[poolName]; pool.ReturnObjectToPool(poolName, go); } else { Debug.LogWarning("No pool available with name: " + poolName); } }
public GameObject Get(string poolName) { GameObject result = null; if (m_GameObjectPools.ContainsKey(poolName)) { QGOPool pool = m_GameObjectPools[poolName]; result = pool.NextAvailableObject(); if (result == null) { Debug.LogWarning("No object available in pool. Consider setting fixedSize to false.: " + poolName); } } else { Debug.LogError("Invalid pool name specified: " + poolName); } return(result); }