void Start() { pcInstance = GameObject.Find ("MapLogic").GetComponent<PrefabChest> (); // This implementation was suggested by arrowgamer. // It's way more efficient and easy for the eye // to just look for the particle effect once // and hold an instance of it in a private variable. foreach (Transform child in transform) { if (child.name == "Particle Effect") { this.particleEffect = child; break; } } }
void Start() { pcInstance = GameObject.Find("MapLogic").GetComponent <PrefabChest> (); // This implementation was suggested by arrowgamer. // It's way more efficient and easy for the eye // to just look for the particle effect once // and hold an instance of it in a private variable. foreach (Transform child in transform) { if (child.name == "Particle Effect") { this.particleEffect = child; break; } } }