I’m using this code: (in an Update function)
if (Input.GetKeyDown (KeyCode.Escape)) {
unlock = true;
}
if (unlock) {
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
Screen.fullScreen = false;
} else {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
if (Input.GetMouseButtonDown (0)) {
unlock = false;
}
In the editor, it works as expected. For whatever reason though, in the actual WebGL Build, the cursor does not unlock. I’ve searched thru every script in my project, this is the only code affecting the mouse lock, so I’m confused as to why the mouse won’t unlock. Could someone help me out please?
Edit: I tried building the project as a standalone app, and it works perfectly. This leads me to believe it is a bug with WebGL, has anyone else come across this bug and figured out how to fix it? I need this app to be able to work on webpages.