public void Setup() { this.particleSystems = this.GetComponentsInChildren <ParticleSystem>(true); this.mainParticleSystem = (this.particleSystems.Length > 0) ? this.particleSystems[0] : null; this.count = this.particleSystems.Length; this.ValidateCanvasGroup(); this.particleSystemItems = new ParticleSystemCachedItem[this.particleSystems.Length]; for (int i = 0; i < this.particleSystems.Length; ++i) { var ps = this.particleSystems[i]; var item = ps.gameObject.GetComponent <ParticleSystemCachedItem>(); if (item == null) { item = ps.gameObject.AddComponent <ParticleSystemCachedItem>(); } item.Setup(); this.particleSystemItems[i] = item; } var index = System.Array.IndexOf(this.particleSystems, this.mainParticleSystem); if (index >= 0) { this.mainParticleSystemItem = this.particleSystemItems[index]; } }
public void Setup() { this.particleSystems = this.GetComponentsInChildren<ParticleSystem>(true); this.mainParticleSystem = (this.particleSystems.Length > 0) ? this.particleSystems[0] : null; this.count = this.particleSystems.Length; this.ValidateCanvasGroup(); this.particleSystemItems = new ParticleSystemCachedItem[this.particleSystems.Length]; for (int i = 0; i < this.particleSystems.Length; ++i) { var ps = this.particleSystems[i]; var item = ps.gameObject.GetComponent<ParticleSystemCachedItem>(); if (item == null) item = ps.gameObject.AddComponent<ParticleSystemCachedItem>(); item.Setup(); this.particleSystemItems[i] = item; } var index = System.Array.IndexOf(this.particleSystems, this.mainParticleSystem); if (index >= 0) this.mainParticleSystemItem = this.particleSystemItems[index]; }