Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 sketchers1 · Aug 12, 2012 at 02:07 PM · freezepauseshooter

Pause Button Freezing Game

Hey Everyone! So I have a pause button that has other levels that I access from it, whenever i click those levels, It freezes the game! I have attached a video of an example how. It is in my FPS shooter so when I go back to gameplay, the character is frozen too! The Options Screen, Store 1, and loadedLevel are all freezing... This is the script I have been using:

 var isPaused : boolean = false;
 
 
 function Update()
 {
      if(Input.GetKeyDown("p") && !isPaused)
    {
       print("p");
       Time.timeScale = 0.0;
       isPaused = true;
    }
    else if(Input.GetKeyDown("p") && isPaused)
    {
       print("Unpaused");
       Time.timeScale = 1.0;
       isPaused = false;    
    } 
 }
 
 function OnGUI ()
 {
 
 
     if(isPaused)
     {
       // RenderSettings.fogDensity = 1;
       if(GUI.Button (Rect (500,120,160,40), "Upgrades")){
          Application.LoadLevel ("Store 1");
       }
       if(GUI.Button (Rect (500,160,160,40), "Main Menu"))
       {
          print("Main Menu");
          Application.LoadLevel("IDKStart");
          Time.timeScale = 1.0;
          isPaused = false;
       }
       if(GUI.Button (Rect (500,200,160,40), "Options")){
          Application.LoadLevel ("Options Screen");  
       }
       if (GUI.Button (Rect (500,240,160,40), "Restart")) {
  Application.LoadLevel (Application.loadedLevel);
 }
    } 
 
 
 }
 
 
 @script AddComponentMenu ("GUI/Pause GUI")



And this is the video: http://www.youtube.com/watch?v=prXnjkWHX9E&feature=plcp

Can someone help me figure out/fix the problem? Thanks!!

Comment
Add comment · Show 10
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 TheVectorHunter · Aug 12, 2012 at 04:10 PM 1
Share

You are setting the timeScale to 0 to pause it, in other words everything is frozen because time itself is.

avatar image TheVectorHunter · Aug 12, 2012 at 04:15 PM 0
Share

By the way why are you loading a new scene for gui screens? Do you need help with designing the menu system?

avatar image sketchers1 · Aug 12, 2012 at 04:16 PM 0
Share

Oh I see. For Some reason I was assu$$anonymous$$g that time starts again on a new level loading.. Thanks!!! Can you make that an answers so I can give you credit for it?

avatar image TheVectorHunter · Aug 12, 2012 at 04:35 PM 0
Share

I just made it an answer... and thanks for giving me credit, I have helped about 7-8 people and no one gave me credit.

avatar image TheVectorHunter · Aug 12, 2012 at 04:41 PM 0
Share

Yeah when a level is loaded it carries over the timeScale, I made that mistake myself before:)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by TheVectorHunter · Aug 12, 2012 at 07:05 PM

You are setting the timeScale to 0 to pause it, in other words everything is frozen because time itself is.

By the way why are you loading a new scene for gui screens? Do you need help with designing the menu system?

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 sketchers1 · Aug 13, 2012 at 12:41 AM 0
Share

I have different things that happen on the menus... So yeah. Thats why I have different scenes.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why does Unity freeze for long periods when highlighting some objects in the hierarchy? 0 Answers

Unity is stuttering.. every 1.5 seconds about. 4 Answers

Make enemy wait before attacking player 2 Answers

Pausing the game after player object gets destroyed 1 Answer

Web Player crashes in Pause Menu 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