Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

I want to make a pause button on the scene

Discussion in 'Scripting' started by mitananda, Jun 11, 2014.

  1. mitananda

    mitananda

    Joined:
    Feb 11, 2014
    Posts:
    19
    I want to make a pause button on the scene. if i press the button it will show the guiTexture with a variety of buttons with each different script. so what steps should I do?
    1. How do if I press the pause button on a scene will show guiTexture ?
    2. How do I put a couple of buttons on the guitexture?


     
  2. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Have you looked at the documentation for GUI.Button? That should answer your questions about how to add buttons. You can create a MenuGUI script with your pause button. If the pause button is clicked, you pause the game by setting Time.timeScale = 0 (don't forget to put this back to what it was when you implement your resume button). You should also have a bool pauseMenu which you would set to true when the pause button is clicked.
    Then you just need to put the menu window into an if(pauseMenu){ } and you're done!
     
  3. DricoJD

    DricoJD

    Joined:
    Sep 3, 2012
    Posts:
    15
    Bear with me, I will write you a script
     
    mitananda likes this.