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 ht_shh · Feb 02, 2014 at 03:04 PM · c#guibutton

when game is resumed it would not be resumed from where it was paused ?

i have pause code in my unity and i also created GUI button in the same code to resume the game.

when i originally start the game for first time my character is walking in scene but when i resume after pause it would not walk in scene.

i do not seem to understand what is the reason behind it. if someone can explain me how to eliminate that error that would be big help.

I have attached the part of code where i have can resume game (start button) and quit game when game is paused.

Thanks in advanced

else if (gamePausedBool == true) { GUI.skin = skin ; if(GUI.Button(new Rect(Screen.width * .35f,Screen.height * .10f,300,100), "Start Game")) { Application.LoadLevel("Game"); } if(GUI.Button(new Rect(Screen.width * .35f,Screen.height * .35f,300,100),"Quit Game")) { Application.Quit(); }

Comment
Add comment · Show 2
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 Nanobrain · Feb 04, 2014 at 06:04 AM 1
Share

This is not enough info for us to go on at all. We need to see the code when the game is paused. We need context here. Explain to us what steps are being taken to pause and resume your game. $$anonymous$$ore info, more info.

avatar image ht_shh · Feb 07, 2014 at 04:16 PM 0
Share

well the thing is pause code is working. so when i pause game it stops the game but real problem is when i say start game again it would just remove the menu screen from screen and load level but i am not able to move anything from that scene it stay frezzed even after starting game again.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Maui-M · Feb 07, 2014 at 04:35 PM

I think your issue is using Application.LoadLevel. Instead of using that you should just stop your current game code from running in Update() which would give it the appearance of pausing.

 function OnGui(){
     //The rest of your OnGUI code
     else if (gamePausedBool == true)
     {
         GUI.skin = skin ;
         if(GUI.Button(new Rect(Screen.width * .35f,Screen.height * .10f,300,100), "Resume Game")) {
            gamePausedBool = false;
         }
            if(GUI.Button(new Rect(Screen.width * .35f,Screen.height * .35f,300,100),"Quit Game")) {
            Application.Quit();
         } 
     }
 }
 
 
 function Update(){
     if (gamePausedBool == false){
         // Run your normal game logic here
         // This will not run if the game is paused
     }
 }
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 ht_shh · Feb 14, 2014 at 06:22 PM 0
Share

Thanks you i will try this way as well.

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

20 People are following this question.

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

Related Questions

Hide the ImageTraget in Real world 0 Answers

Android Development; How to use SDK manager! 1 Answer

drawing a line following an object 3 Answers

Problem with Snake Game(input help) 1 Answer

How to measure ad impressions in In-Game Ads? 0 Answers


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