When I use a custom controller (yeah I m struggling with this matter) the default unity rigidbodyfpscontroller , I have a problem with mouse lock, when i press on the menu screens (like inventory abilities etc.) I dont have the mouse cursor available.
I didnt have this problem when i used the default ORK cobtroller. Any way to fix that?
thank you
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
So the MouseLook.cs it doesn't disabled by ork, instead the RigidbodyFirstPersonController does.
and inside MouseLook there is this code referring on lock:
public void SetCursorLock(bool value)
{
lockCursor = value;
if(!lockCursor)
{//we force unlock the cursor if the user disable the cursor locking helper
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
and also:
private void InternalLockUpdate()
{
if(Input.GetKeyUp(KeyCode.Escape))
{
m_cursorIsLocked = false;
}
else if(Input.GetMouseButtonUp(0))
{
m_cursorIsLocked = true;
}
if (m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
else if (!m_cursorIsLocked)
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
}
}
Any thoughts how to do it? because the OnDisable, m_cursorIsLocked = false; that i tried it didnt work (because it doesn't been disabled i guess).
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
That's what actually unlocks the cursor.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!