Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Apr 13, 2014 at 05:45 AM by getyour411 for the following reason:

The question is answered, right answer was accepted

avatar image
1
Question by Jake 3 · Oct 20, 2010 at 12:11 PM · pauseplaystopunpause

In game pause menu

what do i add to this script to make my game pause?

/* GUI.Pause example */

function OnGUI () { if (GUI.Button (Rect (25, 25, 100, 30), "Pause")) { // This code is executed every frame that the Pause remains clicked } }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image
3
Best Answer

Answer by peacemaker · Oct 21, 2010 at 02:52 PM

Take a look at this answer: http://answers.unity3d.com/questions/15963/pause-button-script

Basically, you want to set:

Time.timeScale = 0.0;

to pause and :

Time.timeScale = 1.0;

To resume.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by 777Vortex777 · Apr 13, 2014 at 05:40 AM

My In Game Pause Menu. There is a button to activate it up in the Upper Right hand cornor and you can press "P" to bring it up hope you all enjoy if you want to change were the main menu takes you just change it to the level you want it in the build settings you can get the number it is on line 22

 var paused : boolean = false;
 
     if(GUI.Button(Rect(1835,20,80,20),"Pause"))
     {
     paused = true;
     }
     if(Input.GetKey("p"))
     {
     paused = true;
     }
     if(paused == true)
     {
     GUI.Box(Rect(810,75,300,400),"Menu");
  
     if(GUI.Button(Rect(920,100,80,20),"Resume"))
     {
     paused = false;
     
     }
     if(GUI.Button(Rect(920,130,80,20),"Main Menu"))
     {
     Application.LoadLevel(0);
     }
     if(GUI.Button(Rect(920,160,80,20),"Quit"))
     {
     Application.Quit();
     }
     }
     if(paused == true)
     {
         Time.timeScale = 0;
     }
     if(paused == false )
     {
         Time.timeScale = 1;
     }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image getyour411 · Apr 13, 2014 at 05:44 AM 0
Share

This post is almost 4 years old and there hundreds of pause game Q&A already.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

why cant i play my scene? 2 Answers

When i press play it just pauses right after. 6 Answers

Stop play procedure from within a script 0 Answers

Pause Button Script 4 Answers

Audio keeps playing when paused 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges