How to call all numbers of array?

Hello,

I use array with Renderer. I want to call all all numbers in array by one code. I couldn’t find how to do it. I actually used this one but i get “Array index is out of range” error while runnig the project.

public Renderer[] char;

void disableRenderers()
{
  char[char.Length].enabled = false;
}

So, how can i enable or disable all renderers in array by one line code like this?

I’ve just thought that i can do that with for loop and it worked well. If anyone wants to do such a thing, can use this for loop.

for ( vari = 0; i < char.Length; ++i ) 
 {
char[i].enabled = false;
 }
1 Like