- Home /
How to disable my Script and Gui
*Edit*I updated the script to
function OnMouseDown () {
GetComponent("StartGame").enabled = false;
}
////////////////////////////////////////////////////////////
My Gui Menu is in my Script
var mySkin : GUISkin[];
private var cont : int = 0;
function OnGUI(){ GUI.skin = mySkin[cont%mySkin.Length]; if (GUI.Button(Rect(200, 70, 200, 50), "Start Game")){ Application.LoadLevel(""); Debug.Log("Let the Game Begin"); }
}
Now I want to be able to have an options in my menu as well. The problem is, If I click my Options Gui button, I want to disable all my other gui buttons. Here is the test code I have.
function Start() {
if(Input.GetMouseButtonUp(0))
script = GetComponent("Start Game").enabled = false;
}
What do I need to add to disable my other scripts that contain my gui menu. Right now it doesn't work. My start game script still works even after I press it.
Answer by awesomeaustin316 · Aug 12, 2013 at 05:43 AM
I upgraded from unitygui to ngui and learned about GameObject.setactive.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Re Enable C# script on camera 1 Answer
GUItexture change on mouseenter 3 Answers
In Game Credits? 1 Answer
How to make GUI Text Bigger? 1 Answer