Search Issue Tracker
Fixed
Fixed in 2021.3.31f1, 2022.3.8f1, 2023.2.0a9, 2023.3.0a1
Votes
2
Found in
2020.3.40f1
2022.1.20f1
2022.3.5f1
2023.1.0a15
2023.2.0a1
2023.3.0a3
Issue ID
UUM-16915
Regression
No
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
Comments (2)
-
nonemec
Jul 25, 2023 16:30
Are there any updates about the plans to backport this to 2021.X or 2022.X?
-
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
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.