private List <GameObject> InstantiatePoolObjectsAndAddToMaster(PoolTypes pool) { List <GameObject> objectPool = new List <GameObject>(); for (int i = 0; i < pool.size; i++) { var go = AddNewGameObjectToPool(pool.asset, objectPool); go.SetActive(false); } return(objectPool); }
private PoolTypes CreatePoolFromAsset(IPoolableAsset poolAsset) { PoolTypes newPool = new PoolTypes { tag = poolAsset.GetIPoolableAssetName(), asset = poolAsset.GetIPoolableAsset(), prefab = null, size = poolAsset.GetNumberToPool(), canExpand = poolAsset.GetIsPoolExpandable(), isSelfInstantiating = true, sceneName = GetActiveScene() }; poolTypes.Add(newPool); return(newPool); }
private void AddPoolToMaster(PoolTypes newPoolRef) { List <GameObject> objectPool = InstantiatePoolObjectsAndAddToMaster(newPoolRef); poolMaster.Add(newPoolRef.tag, objectPool); }