I made this texture for main menu back ground. It has some button on it. I made others several GUI.Box which holds my text textures. I want to change my GUI.Box with each button clicked. I have six buttons and six GUI textures. I want to attach each GUI.Box to each button. I want to show only one of them at a time and other want to be hidden. I am going to attach my main menu texture that you guys will understand clearly.
At the top of your script:
public var textures : Texture[];
private var whichTexture = 0;
Inside each button, set whichTexture to the index of the texture to display:
if (GUI.Button(Rect(...), someTexture) {
whichTexture = 2;
}
Then in your GUI.Box() call:
GUI.Box(Rect(...), textures[whichTexture]);
You initialize ‘textures’ by setting the size and dragging and dropping them into the array in the Inspector.