Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Cursor.lockState stop working on loosing focus after updating to Unity 2018,1

Discussion in 'Scripting' started by daven8989, Jun 4, 2018.

  1. daven8989

    daven8989

    Joined:
    Jan 25, 2014
    Posts:
    29
    Hello, I have a problem with the Cursor.lockState from when we updated to Unity 2018.1 (from 2017.2).
    In particulare the lockState seems to stop working (no metter wich CursorLockMode you set it) when application loose focus (both on windows and on linux standalone build) "alt+tabbing" or using the windows button on keyboard. No metter if when application gain focus again you set lockstate to locked, the arrow of the mouse will not be confined in the screen (I have a second monitor attached, and the arrow goes on the second monitor event if the lockState is set to locked or confined). The only way to make this working is to toggle run in backgroun from playerprefs but we don't want the application running when is in background. Someone else faced this issue?
     
  2. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    3,015
    Yes, I am seeing exactly the same problem with Unity 2018.1. Did you ever find a fix for this?