Cursor.lockState Confined Doesn't Work In Editor?

Is there anyway to get the cursor to lock to the editor window? Currently I have the following line in an update script and it doesn’t seem to work.

Cursor.lockState = CursorLockMode.Confined

Apologies for the 2 year old bump, but this issue persists and all the info needed is here :slight_smile:

Cursor.lockState = CursorLockMode.Confined; // keep confined in the game window

No idea, but Screen.LockCursor used to work, why doesn’t it now?

Works for me, did you click on the game window after hitting play?

If you read the docs, it doesn’t work everywhere: