Hey Guys!
I ll try to make this simple...
I have 10 different buttons and I want to create a single function that could change their sprite NormalGraphic, with a variable.
My buttons are called button1,button2...button10
Is there a way to select those buttons with just one line of code, instead of detailing all the possibilities.
So instead of :
{
var=Random(9);
if(var==1){button1.NormalGraphic++;}
else if(var==2){button2.NormalGraphic++;}
...
else if(var==9){button9.NormalGraphic++;}
else {button10.NormalGraphic++;}
}
I m looking for the correct spelling (if one) to do something like this :
{
var=Random(9);
button[var].NormalGraphic++;
}
In other words, how to apply an int number to a button number ?
Do you see what I mean? And is that possible ? I guess so because it would be so heavy otherwise
Thanks a lot :)
You can use the GUI's .Controls[] array for that.
That looks like a good lead,didn't know about this. Thanks a lot Khris! :)
Ok so I tried and it's exactly what I needed, it saves a lot of time and is pretty easy to use.
Thanks again! ->solved