Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Cursor lockstate doesn't give expected results on linux

Discussion in 'Editor & General Support' started by TheJohnRudy, Jul 3, 2022.

  1. TheJohnRudy

    TheJohnRudy

    Joined:
    Oct 14, 2019
    Posts:
    9
    OS: Ubuntu 22.04 LTS
    Editor version: 2021.3.5f1
    Hub: 3.2.0

    The cursor escapes the editor window in any state.
    In a built app all are as expected. Only the editors lockstates aren't working.

    Code (CSharp):
    1.     private void OnEnable() {
    2.         Cursor.lockState = CursorLockMode.Locked;
    3.     }
    Kinda makes trying to develop a FPS controller hard if the cursor keeps escaping.
     
  2. TheJohnRudy

    TheJohnRudy

    Joined:
    Oct 14, 2019
    Posts:
    9
    Possible solution:

    Detach game window from the editor and, press inside the window, once in playmode.
    Seems that focus is lost when starting playmode. If the window is attached pressing on the window didn't work. Hopefully this will be fixed in later version.