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.
Xtro
2
Enable/disable your UI panel via regular Unity SetActive method.
gameObject.SetActive(false); // or true
gameObject is the link to your panel gameobject.