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 /
avatar image
0
Question by Xedfire 1 · Mar 05, 2011 at 04:50 PM · menupauseglitchtimescale

Pause Menu Problem

I am in the process of releasing an update for my game. I'm trying to make a pause menu, but it is not working like I would really prefer it to. The problem isn't game-breaking, but it is a pain. Basically, when pause is activated by pressing escape, the timescale is set to 0, so everything stops. BUT, if the player keeps spamming the escape key, the time stutters forward. Here is my code:

var level : int; var check : boolean = false; var doWindow0 : boolean = false;

function DoWindow0 (windowID : int) { if(GUI.Button (Rect (10,30, 150,20), "Back to Menu")) Application.LoadLevel(level);

  if(GUI.Button (Rect (10,50, 150,20), "Return to Game"))
  {
     BackToGame();
  }

}

function OnGUI () {

 if (doWindow0)
     window = GUI.Window (0, Rect (Screen.width / 2 - 90,Screen.height / 2 - 45,180,90), DoWindow0, "Pause Menu");

}

function Update() {

 //I tried to use all of the button events...

 if(Input.GetButtonUp("Esc"))
 {
 doWindow0 = true;
 Screen.lockCursor = false;
 Screen.showCursor = true;
 Time.timeScale = 0;
 }

 if(Input.GetButtonDown("Esc"))
 {
 doWindow0 = true;
 Screen.lockCursor = false;
 Screen.showCursor = true;
 Time.timeScale = 0;
 }

 if(Input.GetButton("Esc"))
 {
 doWindow0 = true;
 Screen.lockCursor = false;
 Screen.showCursor = true;
 Time.timeScale = 0;
 }

}

function BackToGame() { Screen.lockCursor = true; Screen.showCursor = false; doWindow0 = false; Time.timeScale = 1.0; }

Attach this script to a first person controller prefab and try it out for yourself. Any kind of solution would be appreciated.

If you want to actually play the game that I'm working on (and see if the pause menu update was finished), go here: http://www.kongregate.com/games/Xedfire/island-jumper

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by lingai · Jul 26, 2012 at 11:06 AM

You could try using

WaitForSeconds(variable);

^this will pause time for a bit i guess

http://docs.unity3d.com/Documentation/ScriptReference/WaitForSeconds.html

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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Pause menu doesn't pause everything 0 Answers

Resume Game with Timescale + Score? 1 Answer

hi i just got the ultimate fps camera and it is not compatible with pausemenus 0 Answers

Pause menu... Isn't pausing everything... 1 Answer

How to Appease a pause menu in a game that changes it's time scale? 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