Answer the question
In order to leave comments, you need to log in
Recolor the platforms to the colors you like best using an array. How to write the script correctly?
Use a loop to step through the platforms.
Can you please help? I need to use a script to recolor my platforms in different colors. I tried everything and can not do it right:(
Below is my code...
````
public SpriteRenderer [] renderers;
void Start()
{
for( int i =0;i {
float r = UnityEngine.Random.value;
float g = UnityEngine.Random.value;
float b = UnityEngine.Random.value;
float a = UnityEngine.Random.value;
Color color = new Color(r ,g,b,a);
renderers[i].color = color;
renderers[0].color = Color.yellow;
renderers[1].color = Color.magenta;
renderers[2].color = Color.green;
renderers[3].color = Color.blue;
renderers[4].color = color.black;
}
}
````
I will be glad if you help me make the script right)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question