Search Issue Tracker


Fixed in 2021.3.31f1, 2022.3.8f1, 2023.2.0a9, 2023.3.0a1



Found in







Issue ID




Cursor.lockState still returns locked when "Esc" is pressed in the WebGL Player or Editor



Reproduction steps:

# Open the attached project
# Open the “/Assets/Scenes/SampleScene.unity” Scene
# Build And Run the project as WebGL (File > Build Settings > WebGL > Build And Run)
# Press the “L” button in the WebGL Player
# Press the “Esc” button in the WebGL Player
# Observe the cursor and the “Cursor.lockState” property

Expected result: Cursor.lockState is unlocked and the cursor is visible
Actual result: Cursor.lockState is locked even though the cursor is visible

Reproducible with: 2020.3.40f1, 2021.3.12f1, 2022.1.20f1, 2022.2.0b12, 2023.1.0a15

Reproducible on: Windows 10 (21H2)

Note: If that’s the default behavior of the browser and it unfocuses the window to show the cursor, the user mentions that at least the Application.isFocused should be false when the “Esc” button has been pressed

  1. Resolution Note (fix version 2023.2.0a9):

    Add stickyCursorLock API to make cursor lock "sticky" or "unsticky". Sticky cursor lock means that if the browser unlocks the cursor when the user presses the ESC key, the cursor will remain locked in Unity. To match the browser's behavior, users can set the stickyCursorLock to false, which will "unstick" the cursor lock.

Comments (2)

  1. nonemec

    Jul 25, 2023 16:30

    Are there any updates about the plans to backport this to 2021.X or 2022.X?

  2. nonemec

    Mar 27, 2023 16:50

    Great to hear that this long-standing issue without workaround has been fixed. I very much hope it will soon be backported to 2021.3.x

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.