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 ImpactUK · Mar 14, 2012 at 03:37 PM · guinetworkingmultiplayermenupause

Multiplayer pause menu won't disappear

Hello everyone.

I'm currently making a multiplayer tank game and i have come across a problem with the pause menu. When there are two or more users playing on the same server, one of them presses the "escape" key to bring up the menu. This works fine, however when clicking "Resume", the GUI window will stay open instead of disappearing ad the mouse cursor also stays visible, but locked.

If, however, a player is in the server on their own, the pause menu works fine. What could be the problem?

 **Code for pause menu in progress:**
 
     #pragma strict
 
 
     function OnGUI() {
     GUI.BeginGroup (Rect (Screen.width/2-175, Screen.height/2-75-50, 350, 150));
 
     GUI.Box(Rect(0, 0, 300, 250), "");
 
     if(GUI.Button(Rect(55, 10, 180, 40), "Resume")) {
 
         Time.timeScale = 1.0;
 
         var script3 = GetComponent(Pause); 
         script3.enabled = false;
   
         var other : HideShowCursor;
         other = gameObject.GetComponent("HideShowCursor");
           
 
     other.on = true;
               
               var other2 : MouseLook;
               other2 = gameObject.GetComponent("MouseLook");
               other2.on = true;
               
               var other3 : MouseLook;
               other3 =       gameObject.transform.Find("CrateCamera").GetComponent("MouseLook");
               other3.on = true;
     }
     
     
     if(GUI.Button(Rect(55, 100, 180, 40), "Quit")) {
         Application.Quit();
     }
      GUI.EndGroup();
     }

Code for "escape" to bring up pause menu:

 #pragma strict
 
 function Update () {
     if(Input.GetButtonDown("Esc")) {    
         Time.timeScale = 0;
         
         var paused1 = GetComponent(Pause);
         paused1.enabled = true;
         
         var other : HideShowCursor;
     other = gameObject.GetComponent("HideShowCursor");
               other.on = false; 
           
               var other2 : MouseLook;
           other2 = gameObject.GetComponent("MouseLook");
           other2.on = false;
         
             var other3 : MouseLook;
           other3 = gameObject.transform.Find("CrateCamera").GetComponent("MouseLook");
           other3.on = false;
     }
 
 }

Thanks for your help.

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 ImpactUK · Mar 14, 2012 at 03:42 PM 0
Share

Apologies for the poorly formatted code, I can't seem to get it positioned correctly in the question box.

avatar image FLASHDENMARK · Mar 14, 2012 at 04:07 PM 0
Share

I would have fixed it for you, but edits are not showing anymore.

avatar image ImpactUK · Mar 14, 2012 at 04:23 PM 0
Share

Ah, thanks for trying though! $$anonymous$$uch appreciated

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Find GameObjects and then add there name to an array? 0 Answers

Halt function midway until player presses 'OK' then continue 1 Answer

Calling variables and functions 1 Answer

How to make GUI update for all players in a networked game? 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