public void InstantiatePool(EffectOutlet owner) { this.owner = owner; pool = new Pool <GameObject> (); pool.pool = new List <GameObject> (); for (int i = 0; i < capacity; i++) { GameObject effectClone = GameObject.Instantiate(effect.prefab) as GameObject; effectClone.transform.parent = owner.transform; if (effect.disableLoopingParticles) { var particles = effectClone.GetComponentsInChildren <ParticleSystem> (); for (int p = 0; p < particles.Length; p++) { particles[p].loop = false; } } effectClone.SetActive(false); pool.pool.Add(effectClone); } }
void Awake() { instance = this; }