Page 1 of 1

Mouse reappears in Unity Build

Posted: Mon Dec 14, 2020 4:09 pm
by 62qBruv
I am using DS plus Invector in Unity 2019.4.16. You were able to help me before with a mouse problem
(see: https://www.pixelcrushers.com/phpbb/vie ... f=3&t=3902 )
Everything you suggested worked really well and I am grateful. However, I had one small test to make and that was to make a build of my game. When I played the build game the mouse appeared again at the very start of the first scene (locked at centre screen). I could dismiss the mouse by opening the testmenu and closing it again - this hid the mouse. But then the mouse appears again when a conversation finishes and again seems to be locked centre screen. I can open and close the testmenu or the invector inventory screen to hide the mouse again.

I should repeat everything works fine in the Unity editor play mode. This only happens in the build.

Have you any advice on this problem?

Re: Mouse reappears in Unity Build

Posted: Mon Dec 14, 2020 8:22 pm
by Tony Li
Hi,

Untick vThirdPersonInput's showCursorOnStart and unlockCursorOnStart.

If you've ticked the Dialogue System Trigger's Show Cursor During Conversation, make sure you're not also showing and hiding the cursor some other way, such as with the deprecated ShowCursorOnConversation script.

Untick the Dialogue Manager's Input Device Manager > Control Cursor State.

If that doesn't help, look for all of the places that can change the cursor.

Re: Mouse reappears in Unity Build

Posted: Wed Dec 16, 2020 11:49 pm
by 62qBruv
Thank you for your advice. I eventually realised after a lot of testing that I had gone overboard with my show/lock/cursor methods. I had the Dialogue Events component on 3 characters all with the same events added. I got rid of all them and just left the DS TestMenu "Pause While Open" and "Allow Cursor While Open" checked. In the Input Device manager I have "Detect Mouse Control" and "Control Graphic Raycasters" checked. On my Dialogue System Triggers "Show Cursor During Conversation" and "Pause Game During Conversations" are checked.

This fixed the cursor showing up after a conversation ended but it didn't fix the cursor showing at the start of the level or after a game has been loaded. In the end I found a "Mouse Hide Lock" script and added it to a trigger at the Player spawnpoint. Then I had to set up a level-wide trigger that turned the start trigger (and the script) off or I couldn't use the mouse at all in the rest of the game. I know... it's a really ugly fix but it's working. Maybe someone can suggest a better way? And, yes, I have set the Invector character up correctly. The "showCursorOnStart" and "unlockCursorOnStart" are not checked.

Re: Mouse reappears in Unity Build

Posted: Thu Dec 17, 2020 8:32 am
by Tony Li
Hi,

If the Dialogue Manager's Input Device Manager > Control Cursor State is unticked, then probably something other than the Dialogue System is showing the cursor at start. You might do a search for all "Cursor.visible" assignments in your project's code and either set breakpoints or add Debug.Log lines before them. Then play the game from the first scene in build settings to identify the culprit. Or just stick with your workaround for now so you can progress with the rest of your game. :-)

Re: Mouse reappears in Unity Build

Posted: Thu Dec 17, 2020 3:28 pm
by 62qBruv
Yes, I'm fairly sure it's something in the Invector code or something strange is starting to happen with the Unity Input system. I know Unity are now offering a new input system in the package manager but I haven't tried it yet.

I did try a build with all reference to DS in the Hierarchy deactivated but the cursor still showed up at the start. I could stop the cursor showing up by deactivating the Event System that Invector adds when you create a controller but then I have no input at all. So I'll stick with my ugly fix for now. I don't really have the ability to dig around in the code anyway.

Thank you for your help.

Re: Mouse reappears in Unity Build

Posted: Thu Dec 17, 2020 3:58 pm
by Tony Li
Sounds good. Don't switch to the New Input System package. It has a steep learning curve, and it takes extra effort to set up the Dialogue System to work with it. I don't know if Invector works with it at all or not.