Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Constrain the cursor to the window

Discussion in 'Scripting' started by 511, Jun 20, 2015.

  1. 511

    511

    Joined:
    Nov 18, 2012
    Posts:
    55
  2. 511

    511

    Joined:
    Nov 18, 2012
    Posts:
    55
    Am I the only one with this problem? Does
    Code (CSharp):
    1. Cursor.lockState = CursorLockMode.Confined;
    work for you in the editor?
     
  3. 511

    511

    Joined:
    Nov 18, 2012
    Posts:
    55
    It also doesn't fully work in a standalone build. The cursor is still able to move over the title bar.

    Am I the only one with this problem? For me this is pretty much a deal breaker. The only workaround that I can think of would be to use the win32api.
     
  4. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Hide & lock windows cursor and make your own in the game