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
- [URP] Crash on GameObject::QueryComponentByType when baking a Reflection Probe in an unsaved/untitled Scene
- No Icons are used for the Entry and Exit States in the Inspector when selected in an Animator Controller
- Crash on PlayerMain(int, char const**) when exiting Standalone Player with a Particle System in the Scene
- No Icon is used for the Runtime Animator Controller Type in a Search Window when assigning an Animator Controller in the Animator Component
- Unity Version Control server textfield’s text overlaps with the dropdown triangle button in the Explore repositories window when an organization with a long name is selected
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.