- Home /
Question by
ChristianBlandford · Aug 30, 2018 at 01:33 PM ·
mousecursorlock-cursorlockcursor
Cursor won't stay locked in update!!
Using Unity 2018.2.3ft 64bit
Okay so I have this script on an active gameobject.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LockMouse : MonoBehaviour {
// Update is called once per frame
void Update () {
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Locked;
}
}
My issue is that it does not stay locked. If you click off the screen, then enter back, the cursor stays invisible but it is not locked in the centre and is moving around. if i then pause and resume, it will stay locked like its meant to. but it unlocks again if i click off. It does the exact same in the build. Can anyone help?
Comment
Your answer
Follow this Question
Related Questions
Trouble with unlocking cursor 1 Answer
FPS Controller Mouse not locking consistantly 0 Answers
Issues with mouse input when locking the cursor 0 Answers
Cursor.lockState does not work 2 Answers
Alt+Tab pointer problem 0 Answers