using System; using UnityEngine; public class SetSpawnedParticleColor : MonoBehaviour { private Color myColor; private void Start() { SpawnObjects component = GetComponent(); component.SpawnedAction = (Action)Delegate.Combine(component.SpawnedAction, new Action(Go)); myColor = PlayerSkinBank.GetPlayerSkinColors(GetComponentInParent().spawner.playerID).particleEffect; } private void Go(GameObject spawned) { ParticleSystem[] componentsInChildren = spawned.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].startColor = myColor; } LineEffect[] componentsInChildren2 = spawned.GetComponentsInChildren(); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].useColorOverTime = false; componentsInChildren2[j].GetComponent().startColor = myColor; componentsInChildren2[j].GetComponent().endColor = myColor; } } }