I have a compound GameObject that is made up of 5 sprites name dot1 till 5. I'd like to have a little script on the parent object that would allow me to change the colours of the child objects from the unity inspector. I want the colours to change directly in my scene without having to press play. This already happens when I would set the colours directly from the child objects. But I'd like to have the properties visible in my main object and set the colours from there.
So far I'm unable to make the changes visible in scene mode.
[ExecuteInEditMode]
public class Chain : MonoBehaviour {
public GameObject dot1;
public GameObject dot2;
public GameObject dot3;
public GameObject dot4;
public GameObject dot5;
public Color Color1;
public Color Color2;
public Color Color3;
public Color Color4;
public Color Color5;
void Start () {
dot1.renderer.sharedMaterial.color = Color1;
dot2.renderer.sharedMaterial.color = Color2;
dot3.renderer.sharedMaterial.color = Color3;
dot4.renderer.sharedMaterial.color = Color4;
dot5.renderer.sharedMaterial.color = Color5;
}
void Update () {
}
}