Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 FuryFight3r · Jan 06, 2017 at 09:47 AM · animationanimatoranimationspause gamepausegame

Pause Menu issue with mouse

Hey guys, just wondering how i can get my mouse to stay active while in the pause menu, it pops up fine, but then when any buttons are click the Cursor disappears, Have tried with and without 'Cursor.visable = true" and same outcome, have tried looking in Scripting API for Cursor.lockState, but cannot find any coding in relation to C#

Here is the coding for my pausemenu

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 using UnityStandardAssets.Characters.FirstPerson;
 
 public class PauseMenu : MonoBehaviour {
 
     public GameObject Player;
     GameObject PauseCanvas;
     bool paused;
 
 
     // Use this for initialization
     void Start () {
         PauseCanvas = GameObject.Find("PauseMenu");
     }
     
     // Update is called once per frame
     void Update () {
         if (Input.GetKeyDown(KeyCode.Escape))
         {
             paused = !paused;
         }
 
         if (paused)
         {
             //GameObject.Find("Player").GetComponent<FirstPersonController>().enabled = false;
             PauseCanvas.SetActive(true);
             Time.timeScale = 0;
             //Cursor.visible = true;
         } else if (!paused)
         {
             //GameObject.Find("Player").GetComponent<FirstPersonController>().enabled = true;
             PauseCanvas.SetActive(false);
             Time.timeScale = 1;
             //Cursor.visible = false;
         }
     }
 
     public void Resume()
     {
         paused = false;
     }
 
     public void Quit()
     {
         SceneManager.LoadScene("MainMenu");
     }
 }
 

Also upon loading the 'MainMenu' from the Quit() void, my main camera animation on that scene fails to start, it loads but just sits at the very start without animating.

Have provided a Video to assist in providing the right help. Youtube Video Link

@crazyKnight @MikeNewall @alejandro-unity

'@' Tagged due to all posts being moderated upon post

Comment
Add comment · Show 4
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 FuryFight3r · Jan 06, 2017 at 10:39 AM 0
Share

bump due to 22hr wait time on moderation approval

avatar image romatallinn · Jan 06, 2017 at 10:44 AM 0
Share

What kind of buttons lead to disappearing mouse (UI buttons)? Do they have their own scripts? During the gameplay the cursor is disabled? If yes, do you disable it in another script?

avatar image FuryFight3r romatallinn · Jan 06, 2017 at 11:00 AM 0
Share

Just my settings button as is is the only button that attempts to open up a second canvas and doesn't do action on that single click, it use to do it with my Exit Game Button also, but to overcome that issue was to remove the confirmation canvas "are you sure you want to exit" and just exit the game on that button click, but even if i don't click on a button just in a blank space on the pause menu the mouse still disappears, the settings canvas wont even open when i click on settings anyway, so its not even getting to the point of activating the settings canvas script.

EDIT: Also if you have a look at the video i have provided it may make everything clearer

avatar image FuryFight3r · Jan 06, 2017 at 10:20 PM 0
Share

Any clues as to how this can be achieved?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by ScaniX · Jan 07, 2017 at 12:08 AM

Are you using the RigidbodyFirstPersonController or probably just the MouseLook script component somewhere else?

The MouseLook locks and hides the mouse cursor on release of the left mouse button. To avoid this, call SetCursorLock(false) on the MouseLook.

PS: As for the animation problem: You need to ensure that the Time.timeScale is set back to 1 when leaving the menu, no matter in what way. If you want to keep the timeScale at zero, you can still play animations by setting them to use unscaledTime.

Comment
Add comment · Show 3 · 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 FuryFight3r · Jan 07, 2017 at 02:16 AM 0
Share

i am using a RigidbodyFirstPersonController from the standard assets. and thank you for the the animation tip, so should i set the timescale back to 1 within the Quit void? or on a start function in the $$anonymous$$ain$$anonymous$$enu Scene?

avatar image ScaniX FuryFight3r · Jan 07, 2017 at 10:39 AM 0
Share

I am making sure that the code that sets it to something different than 1 will set it back to normal in the end. That is the case for every effect or mode that I set to something different than "normal".

As an additional safety hook I have a global reset call at certain points (e.g. start of level) that will reset all those states like timeScale, player interaction mode, visual fx, etc. in case something unpredictable has happened. After years in this job I can say that the only thing that is 100% certain is the unpredictable. ;)

avatar image Jericea · Aug 12, 2018 at 11:47 AM 0
Share

Thank you so much for this answere. I literally searched 3 hours to fix my "after escape-menu cursor show up" - Bug and it was the $$anonymous$$ouseLook. :-)

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

7 People are following this question.

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

Related Questions

animation blending error (Animator Unity4) 0 Answers

How can I change my AnimatorState instantly? 1 Answer

Shooting animation playing for longer than a second? 1 Answer

Animation Running Game 0 Answers

Play animation while button is pressed fails when using boolean parameters. 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