Hi folks, I have a question on a List.
I have a series of blocks which I have assigned to a list.
I am attempting to change their colour by cycling thorugh them but I am unsure of the correct way to phrase the code.
I have the following…
I’m not sure where I should put ’ blocks ’ and how exactly I should format it in the code so as to cycle through each iteration.
Help appreciated
2h
```csharp
-
public void NewColour(float newColourNumber)
{
startColourNumber = newColourNumberfor (int i = 0; i < blocks.Count; i++)
{
Debug.Log ("Number of Blocks = " + blocks.Count);
if (newColourNumber == 1) {
rend.material.color = Color.blue;
//Debug.Log ("NewColourNumber Value = " + newColourNumber);
} else if (newColourNumber == 2) {
rend.material.color = Color.red;
//Debug.Log ("NewColourNumber Value = " + newColourNumber);
} else if (newColourNumber == 3) {
rend.material.color = Color.yellow;
//Debug.Log ("NewColourNumber Value = " + newColourNumber);
}
}
}*
```