public GameObject GetObjectFromPool(string poolName, bool autoActive = true, int autoCreate = 0)
{
GameObject result = null;
if (!poolDict.ContainsKey(poolName) && autoCreate > 0)
{
InitPool(poolName, autoCreate, PoolInflationType.INCREMENT);
}
if (poolDict.ContainsKey(poolName))
{
Pool pool = poolDict[poolName];
result = pool.NextAvailableObject(autoActive);
//scenario when no available object is found in pool
#if UNITY_EDITOR
if (result == null)
{
Debug.LogWarning("[ResourceManager]:No object available in " + poolName);
}
#endif
}
#if UNITY_EDITOR
else
{
Debug.LogError("[ResourceManager]:Invalid pool name specified: " + poolName);
}
#endif
return result;
}