[SOLVED] Show/Hide mouse on ESC for menu

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

The Dialogue System's example scenes don't do anything with the cursor. They just leave the cursor untouched (visible) the whole time.

Are you using your HideLockMouse script and the pause menu at the same time? They'll step on each others' toes. As a test, try removing HideLockMouse and anything else that controls the cursor except for the UI/pause menu. Then test it out. Don't engage in a conversation yet. Let's make sure everything is working perfectly in the editor and a build before bringing conversations into the mix.

If it's still not behaving, can you put together an example reproduction project and send it to tony (at) pixelcrushers.com?
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

If I just use the ui by itself and nothing else, the cursor shows the whole time. I don't know if it matters, but I've never been able to pull up the menu or pause menu in my main scene editor play. Maybe that's because my menu and pause menu ui are in a different scene hierarchy?

Actually never mind, I played in editor mode from my ui scene and clicked start to enter my other scene and I can now pull up the pause menu. Nice, this should be a lot faster than making a build every time.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

supadupa64 wrote:If I just use the ui by itself and nothing else, the cursor shows the whole time. I don't know if it matters, but I've never been able to pull up the menu or pause menu in my main scene editor play. Maybe that's because my menu and pause menu ui are in a different scene hierarchy?

Actually never mind, I played in editor mode from my ui scene and clicked start to enter my other scene and I can now pull up the pause menu. Nice, this should be a lot faster than making a build every time.
Great! What happening with the cursor now?
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

Actually the same thing as at first. Everything works except if I hit ESC a second time the cursor shows indefinitely. The cursor functions perfect if I select "leave" or "close" or "resume," but if I try to cancel the UI or a dialogue using ESC, it shows the cursor forever.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

Did you try removing HideLockMouse before playing?

I'll try reproducing this later today with the menu template prefab and TPC.
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

Yeah I've tried it a lot of times, quite a few different ways. The solution has to be close... I disabled the TPC, but then it's kind pointless since I need it to disable cursor in game anyhow, and the menu isn't doing it. I really appreciate the help.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

Okay, I'll try to reproduce it here. If possible, please put together a reproduction project and send it to me. Otherwise I'll just use the vanilla TPC and menu template setups.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

It's Third Person Controller. When you press Escape, it always show the cursor. For the next release, I'll ask Justin to add a way to disable this functionality. In the meantime, import the TPC source code. Then edit UnityInput.cs and change line 161 from this:

Code: Select all

                if (UnityEngine.Input.GetKeyDown(KeyCode.Escape)) {
to this:

Code: Select all

                if (false && UnityEngine.Input.GetKeyDown(KeyCode.Escape)) {
User avatar
supadupa64
Posts: 200
Joined: Sun Mar 06, 2016 9:40 pm
Contact:

Re: Show/Hide mouse on ESC for menu

Post by supadupa64 »

That did work, however, I now have thousands of errors and tons of lag. I changed it all back in the meantime.
User avatar
Tony Li
Posts: 22107
Joined: Thu Jul 18, 2013 1:27 pm

Re: Show/Hide mouse on ESC for menu

Post by Tony Li »

Justin's putting the change in TPC 1.3.

Regarding the errors and lag, did you remember to remove the Scripts folder before importing the source package?
Post Reply