1. Enter the Microsoft Developer Challenge for a chance to win prizes. Read more about it here.
  2. Enter the Google Play Indie Games Contest in Europe. Read more about it here.
  3. Unity 5.5 is now released.
  4. Become a closed-alpha partner on the new Facebook games platform. Read more about it here.
  5. Get early access to our Google Daydream Technical preview. Click here for more details!

How to keep mouse cursor in the screen ?

Discussion in 'Scripting' started by Erguntech, Apr 24, 2011.

  1. Erguntech

    Erguntech

    Joined:
    Feb 21, 2011
    Messages:
    11
    Hi guys,
    I builded a little sample game with first person shooter script. everything works well with it, and its windowed screen.

    I start the game and when the mouse goes of the screen the character turns too much.

    I want that the mouse cursor cannot go out of the screen. What is the way to do that ?

    Any help would be apreciatted... :rolleyes:
     
  2. BlackGecko

    BlackGecko

    Joined:
    Mar 25, 2011
    Messages:
    10
    I tried hiding the cursor but it didn't work. The cursor can still go out of the window. Maybe the screen object can be helpful
     
  3. Tavahka

    Tavahka

    Joined:
    May 10, 2011
    Messages:
    7
  4. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Messages:
    1,565
    Screen.lockCursor may be your only option in this case.