Random texture in GUI


I’m making a main menu and I want to have a side picture that is random every time you go to the menu. I made it into a GUI.Label to keep it simple. But when I play it, it scolls trough all the pictures and never stops. What do I do?

My code:

GUI.Label(new Rect(600, 100, 600, 600), sideGuy[Random.Range (0, sideGuy.Length)]);

I can give you a more definite answer if you post more of your code, but this is most likely because this line is written in an OnGUI function. This means that your specific line of code will be repeated over and over every event, causing the number to be regenerated every time. Try generating a random number in an Awake function, or somewhere it will only generate once, and then refer to that number in your label.