A
A
Alexander2021-06-07 07:51:03
Unity
Alexander, 2021-06-07 07:51:03

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 question

Ask a Question

731 491 924 answers to any question