- Home /
Ngui Pause menu???
I have created a pause menu for my game. I use to have a unitygui menu where it would call on gui boxes. However, now that this gui is actually a game object I have no idea how to activate and deactive it when I press escape. Ngui is very helpful and customizable so I don't want to go back to regular unitygui. If anyone could help me out it would be great.
Here is the code I use to pause
var waspressed = false;
var lockCursor:int;
var pauseSound : AudioClip;
function Start () {
Screen.lockCursor = true;
}
function Update () {
if(Input.GetKeyDown(KeyCode.Escape)){
Screen.lockCursor = false;
waspressed = true;
Time.timeScale =0;
}
It pauses like it should, but I can't activate or deactivate my buttons.
Answer by Xtro · Aug 05, 2013 at 08:48 PM
Enable/disable your UI panel via regular Unity SetActive method.
gameObject.SetActive(false); // or true
gameObject is the link to your panel gameobject.
Thank you!! I have been using uscript since i'm not adept to scripting. I decided that regular scripting would do good for this though.
I also just realized that this method was in the Script reference pages. I feel stupid now.
Don't feel stupid. No one can memorize all the reference pages.