So my basic premise is that I don’t want the GUI to show up until the player clicks the start button.
Below is the very rudimentary script I’m using to make this happen.
static var gameOn : int = 0;
function OnGUI(){
if(gameOn == 0){
if(GUI.Button(Rect(10,70,50,30),"Click")){
gameOn = 1;
GameObject("GUI Console").guiTexture.enabled = true;
}
}
}
Problem is when I click the button, I get this error:
However there is, in fact, a gui texture attached to said object. I’ve disabled it, so it can be enabled when this button is clicked. Yet even when I try things in reverse (initially enabling the texture, and telling the button to disable it) I get the same error.
There’s another script, built into the GUI Console game object itself, that references the texture quite regularly just fine.
What am I doing wrong heere?