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);
}
}