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 seyyid · Mar 09, 2011 at 01:21 AM · scenepausemainmenuunpause

Main Menu in different scene - pause game

hello

i m new in uniy3d development and i have created a prototype game but i m currently facing with the problem on my main menu

i have been searching scripts or methods to pause my game but all i found is scripted for the game menus created in GUI and my menu is not on gui it s designed on scene as game object

Basically i have 3 scenes

Level 0: Main Menu
Level 1: Game
Level 2: Ingame Menu

and i have gamestate script attached to my player which contains

             void Update () 
               {

     if(Input.GetKeyDown("escape"))
         {
     Time.timeScale = 0;
     Application.LoadLevel(2);

         }
               }

when i hit escape button during game , it goes to ingame menu... fine
but i m not quite sure if it freezes game by setting Time.timeScale to zero because it loads another scene anyway

my ingame menu scene has resume button which is scripted as

else if(isResumeButton) { Time.timeScale = 1; Application.LoadLevel(1);

 }

so i couldnt find what i want from PauseGame example on unifycommunity and any other examples

any help or idea is appreciated

thanx in advance

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

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Joshua · Mar 09, 2011 at 02:50 AM

Personally it seems a lot easier to have an in-game menu, but okay. What you want is to put in the Start () function of your level 0 the code to pause the game, so it happens as soon as the level is loaded. So in the function where you also have your resumebutton put the script:

function Start () {

Time.timeScale = 0;

}

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
0

Answer by seyyid · Mar 09, 2011 at 04:05 AM

thanx for reply

my first level is main menu which contains "play game" button so when i hit that button it loads level 1 which is game itself

my question is when i m on level 1 "game" i hit escape button which goes to ingame menu as i add my script in my question sets the time to zero

ingame menu is level 2 and my "resume game" button is scripted as Time.timeScale = 1 and load level 1 "game" it is supposed to continue the game where i left but it starts the level all over from beginning

you suggest me to add Time.timeScale = 0; function on my main menu script which freezes the level 1 at all and even though i set the value 1 and same function to my resume button it still does not work.

any other suggestion?

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
0

Answer by Manpreet_96 · Jun 25, 2017 at 07:59 AM

Hey @seyyid , I see this a very old query and you must have pitched an idea by now. I am having the same trouble but could'nt find a solution yet. I know, one approach is similar to saving a game. You save the states of all the important objects on your hard drive and then enter the another scene and when you come back you load the saved states from the point you left.But how to do this is my question. If you have a solution to or anybody can point in right direction , please respond...

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

No one has followed this question yet.

Related Questions

why cant i play my scene? 2 Answers

Updating main menu using PlayerPrefs when collecting an object in different scene (level) 1 Answer

Sound on pause it doesn't works. 2 Answers

Is there a way to script the scene to pause itself or debug. 1 Answer

Changing two different objects renderer colour 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