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 Karlos 42 · Oct 13, 2012 at 07:49 PM · menumain menu

Pause and Main Menu Problem

When I go onto the MainMenu scene I can click play and the game will load. But when I pause it and click on "Main Menu", it goes to the menu but I can't enter the game again. Does anyone know why?

Here is the script for the PauseMenu:

 var menuHeight:float=500;
 var menuWidth:float=500;
 
 var buttonSpacing:float=25;
 var MainMenu: String = "Main Menu";
 var titleTexture:Texture2D;
 
 var customSkin:GUISkin;
 var customStyle:GUIStyle;
 
 function OnGUI(){
 GUI.skin = customSkin;
 GUILayout.BeginArea(Rect(Screen.width/2-menuWidth/2,Screen.height/2-menuHeight/2,menuHeight,menuWidth),customStyle);
 GUILayout.Space(50);
 GUILayout.Label(titleTexture);
 GUILayout.Space(buttonSpacing);
 if(GUILayout.Button("Main Menu")){
 Application.LoadLevel(MainMenu);
 }
 
 GUILayout.Space(buttonSpacing);
 if(GUILayout.Button("Exit to Desktop")){
 Application.Quit();
 }
 
 GUILayout.Space(buttonSpacing);
 GUILayout.EndArea();
 }
Comment
Add comment · Show 3
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 TheDarkVoid · Oct 13, 2012 at 09:34 PM 1
Share

you need to show the code, it's defiantly a problem with the code.

avatar image hvilela · Oct 14, 2012 at 02:40 AM 0
Share

Do you mean the Unity pause button? That's the function of the button, pause all your scripts.

avatar image Karlos 42 · Oct 14, 2012 at 11:56 AM 0
Share

i've got a code for a pause menu but i'm going to try a new one because it doesn't stop the mouselook.

And it isn't the built in Unity pause button its an added script

1 Reply

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

Answer by TheDarkVoid · Oct 14, 2012 at 04:10 PM

I would recommend doing something like this when you pause the game:

foreach( GameObject g in GameObject.FindObjectsOfType(typeof(GameObject))) { g.SendMessage("Pause"); } and this for unpauseing:

foreach( GameObject g in GameObject.FindObjectsOfType(typeof(GameObject))) { g.SendMessage("UnPause"); }

And add this to the scripts that you want to be paused:

public void Pause() { isPaused = true; } public void UnPause() { isPaused = false; }

then based on if isPaused == true, you can pause you scripts

Comment
Add comment · Show 2 · 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 Karlos 42 · Oct 14, 2012 at 06:06 PM 0
Share

thanks for the help TheDarkVoid

avatar image TheDarkVoid · Oct 14, 2012 at 06:10 PM 0
Share

no problem

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

10 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

Related Questions

Options Menu doesnt work after scene change 2 Answers

Returning to main menu 1 Answer

Best way to create a Main Menu 1 Answer

Is there anyway to create a outer glow on an object in Unity Indie via script? 1 Answer

How do i add an extra menu to my main menu (I'm a Beginner programmer!) 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