Adding in script. Look at details.
I am first attaching my script as the gameobjects Rings can only attach in play mode. They only appear one by one. I would like if it would find the game objects with the tag "Rings" and make the script attach to all them. In this script, it changes the color of the gameobject Rings.
public class Great : MonoBehaviour { public GameObject[] Rings; private int Time = 10; public Color ColorRed = Color.red; public Color ColorGreen = Color.green; public int iterations = 100000; public int maxRange = 100;
public IEnumerator Start()
{
float rnd = Random.value;
Rings = GameObject.FindGameObjectsWithTag ("Rings");
Renderer rend = GetComponent<Renderer> ();
yield return new WaitForSeconds (Time);
if (rnd < 0.7f) {
Debug.Log ("Green");
rend.material.SetColor ("_Albedo", ColorGreen);
} else {
Debug.Log ("Red");
rend.material.SetColor ("_Albedo", ColorRed);
}
}
}
Comment