Page 1 of 1

(Solved) Help setting up the cursor lock.

Posted: Sat Dec 07, 2019 9:09 am
by drandy007
I'm using an FPS controller that I created for my player controls. Its using

Code: Select all

Cursor.lockState = CursorLockMode.Locked
to lock the cursor as it uses a raycast for interaction but, when I import the Dialogue System for Unity it no longer locks the cursor. I assume that this is due to needing the cursor to interact with the dialogue ui. I can create a state system that when I start a conversation that it unlocks the cursor and locks it after conversation has ended. I just need to know how to setup the cursor lock at the start of the game and how I unlock it. I tried adding

Code: Select all

PixelCrusher.CursorControl.LockCursor(true)
to the start method on my player but, that didn't work. I couldn't find any info on how to do the locking and unlocking so, I'm unsure of what to do. Can any1 help please?

Re: Help setting up the cursor lock.

Posted: Sat Dec 07, 2019 2:01 pm
by Tony Li
Hi,

Inspect the Dialogue Manager's Input Device Manager component and untick Control Cursor State.

When the Input Device Manager's Detect Mouse Control and Control Cursor State checkboxes are ticked, it will hide the cursor when it detects that the player is using a joystick. It will show the cursor when it detects that the player is using a mouse.

If you untick Control Cursor State, it will not touch the cursor's lockState or visible state, in which case you're responsible for managing that yourself.

Re: Help setting up the cursor lock.

Posted: Sat Dec 07, 2019 9:47 pm
by drandy007
Thanks

Got it working now.