(Solved) Help setting up the cursor lock.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
drandy007
Posts: 4
Joined: Sat Dec 07, 2019 8:56 am

(Solved) Help setting up the cursor lock.

Post 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?
Last edited by drandy007 on Sun Dec 08, 2019 5:16 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help setting up the cursor lock.

Post 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.
drandy007
Posts: 4
Joined: Sat Dec 07, 2019 8:56 am

Re: Help setting up the cursor lock.

Post by drandy007 »

Thanks

Got it working now.
Post Reply