1. Submit bugs to enter our 5.4 Beta Sweepstakes. Read more about it here.
  2. Unity 5.4 public beta is now available for all users. Grab the build and visit the 5.4 beta forum.
  3. Missing a module? More about the new installer in 5.3 here.
  4. 4.7.1 released for Xcode 7.3 support. Thread here.

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,564
    Screen.lockCursor may be your only option in this case.