Answer the question
In order to leave comments, you need to log in
How to block the cursor in Unity so that it does not go beyond the playing field (It works in Unity, but not when loaded into the browser)?
public void Update()
{
if (Input.GetKey(KeyCode.L) )
{
Cursor.visible = false;
Cursor.lockState = CursorLockMode.Confined;
print("Cursor is Locked!");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question