Cursor locking and full-screen mode in WebGL - Safari

Is there any way to get this working in Safari?

void Start ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
}
void Update ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
}



For Toggled Mouse Lock/Hide in C#:

bool CursorLockedVar;

void Start ()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
CursorLockedVar = (true);
}

void Update ()
{
if (Input.GetKeyDown ("escape") && !CursorLockedVar) {
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = (false);
CursorLockedVar = (true);
}
else if(Input.GetKeyDown("escape") && CursorLockedVar){
Cursor.lockState = CursorLockMode.None;
Cursor.visible = (true);
CursorLockedVar = (false);
}
}

Safari does not support cursor locking yet. But they are adding support in Safari 10.1, the upcoming next version of Safari.

1 Like

Thanks. That’ll be awesome.