1
NGUI 3 Support / Using NGUI for pause menu
« on: February 18, 2014, 12:51:20 PM »
Hi everyone, this is my first post!
I've got a little question which I can't seem to figure out the answer to, and was wondering if you guys 'n gals can help me out.
I've created a GUI in UIRoot for a pause menu. I've created a script to pause the game but I'm unsure how I can make the NGUI UI appear when the pause button is pressed and dissapear when players press the pause button again.
It sounds so simple, but I can't figure it out.
My current code:
How would I make it hide/unhide my NGUI ui when the game is paused?
Thanks in advance for the help!
- R
I've got a little question which I can't seem to figure out the answer to, and was wondering if you guys 'n gals can help me out.
I've created a GUI in UIRoot for a pause menu. I've created a script to pause the game but I'm unsure how I can make the NGUI UI appear when the pause button is pressed and dissapear when players press the pause button again.
It sounds so simple, but I can't figure it out.
My current code:
- using UnityEngine;
- using System.Collections;
- public class Pause : MonoBehaviour {
- private bool pauseEnabled = false;
- void Start (){
- pauseEnabled = false;
- Time.timeScale = 1;
- AudioListener.volume = 1;
- Screen.showCursor = false;
- }
- void Update (){
- if(Input.GetButtonDown ("pauseButton")){
- if(pauseEnabled == true){
- pauseEnabled = false;
- Time.timeScale = 1;
- AudioListener.volume = 1;
- Screen.showCursor = false;
- }
- else if(pauseEnabled == false){
- pauseEnabled = true;
- AudioListener.volume = 0;
- Time.timeScale = 0;
- Screen.showCursor = true;
- }
- }
- }
- }
How would I make it hide/unhide my NGUI ui when the game is paused?
Thanks in advance for the help!
- R
