Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mouse pointer not showing on pause menu

Discussion in 'Scripting' started by krisian, Feb 6, 2014.

  1. krisian

    krisian

    Joined:
    Nov 22, 2013
    Posts:
    8
    Hello guys just need some help for this code. What I am aiming for is for the mouse pointer to be shown

    Thanks in advance! :)

    var restart : String;
    var goWorld : String;
    var pauseMenuFont : Font;
    private var pauseEnabled = false;

    function Start(){
    pauseEnabled = false;
    Time.timeScale = 1;
    AudioListener.volume = 1;
    Screen.showCursor = false;
    }

    function Update(){

    //check if pause button (escape key) is pressed
    if(Input.GetKeyDown("escape")){

    //check if game is already paused
    if(pauseEnabled == true){
    //unpause the game
    pauseEnabled = false;
    Time.timeScale = 1;
    AudioListener.volume = 1;
    Screen.showCursor = false;
    }

    //else if game isn't paused, then pause it
    else if(pauseEnabled == false){
    pauseEnabled = true;
    AudioListener.volume = 0;
    Time.timeScale = 0;
    Screen.showCursor = true;
    }
    }
    }

    private var showGraphicsDropDown = false;

    function OnGUI(){

    GUI.skin.box.font = pauseMenuFont;
    GUI.skin.button.font = pauseMenuFont;

    if(pauseEnabled == true){

    //Make a background box
    GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,200), "Tumigil");

    //Make Main Menu button
    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Ulitin")){
    Application.LoadLevel(restart);
    }


    if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Bumalik sa mundo")){
    Application.LoadLevel(goWorld);

    }


    //Make quit game button
    if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Umalis")){
    Application.Quit();
    }
    }
    }


    Sorry was noobish of me.figured it out now.thanks :)
     
    Last edited: Feb 6, 2014
  2. shadowpuppet

    shadowpuppet

    Joined:
    May 7, 2015
    Posts:
    23
    thats nice you figured it out. But, see, when people like me are having the same problem and Google it and venture to a page like this...it doesn't help a damn little bit! How hard would it have been to explain what you found