Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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