View Issue Details

IDProjectCategoryLast Update
0017495Stars Beyond ReachGUISep 26, 2015 12:27 pm
ReporterPeons Assigned ToChris_McElligottPark  
Status closedResolutionnot fixable 
Product Version0.910 (Now With Fewer Bugs) 
Summary0017495: Mouse is not bound to edge of screen in multiple monitor setup - Ref: 0016167 w/ new info
DescriptionNot sure what the etiquette on this kind of thing is, but as most of your games have this issue I figured I'd report it as well.

This is a fairly minor issue for most of your games, and I'd say AI war is probably the only one where it annoys me really :)

http://docs.unity3d.com/ScriptReference/Screen-lockCursor.html

Downside to this is you'd have to handle the drawing of the mouse cursor and events yourself. Also someone else ran into a similar issue and used ProMouse

 // ****** code for ProMouseControl.cs
 using UnityEngine;
 using System.Collections;
 
 public class ProMouseControl : MonoBehaviour {
 
     private bool controlMouse;
     
     void Start () {
         ProMouse.Instance.SetCursorPosition(Screen.width/2, Screen.height/2);
         controlMouse = true;
     }
 
     void Update () {
         int mouseX = (int)ProMouse.Instance.GetLocalMousePosition().x;
         int mouseY = (int)ProMouse.Instance.GetLocalMousePosition().y;
         if (controlMouse) {
             if ( mouseX <0) {
                 ProMouse.Instance.SetCursorPosition(0,mouseY);
             }
             if ( mouseX > Screen.width) {
                 ProMouse.Instance.SetCursorPosition(Screen.width,mouseY);
             }
             if ( mouseY <0) {
                 ProMouse.Instance.SetCursorPosition(mouseX,0);
             }
             if ( mouseY > Screen.height) {
                 ProMouse.Instance.SetCursorPosition(mouseX, Screen.height);
             }
             if (Input.GetKeyUp("escape") ) {
                 Time.timeScale = 0;
                 controlMouse = false;
             }
         } else if (Input.GetKeyUp("escape") ) {
             Time.timeScale = 1;
             ProMouse.Instance.SetCursorPosition(Screen.width/2, Screen.height/2);
             controlMouse = true;
         }
     }
 }

Reference: http://answers.unity3d.com/questions/62440/how-to-stop-mouse-going-out-of-the-screen-.html

TagsNo tags attached.

Activities

Chris_McElligottPark

Sep 26, 2015 12:27 pm

administrator   ~0043040

That doesn't actually do what you want, unfortunately -- that is more for an FPS game. It locks the cursor to the center of the screen. You can then move the cursor and the game detects the movement I believe, but not position on the screen. As they note, even for in-game menus you still have to unlock the cursor again.

Issue History

Date Modified Username Field Change
Sep 24, 2015 8:57 pm Peons New Issue
Sep 26, 2015 12:27 pm Chris_McElligottPark Note Added: 0043040
Sep 26, 2015 12:27 pm Chris_McElligottPark Status new => resolved
Sep 26, 2015 12:27 pm Chris_McElligottPark Resolution open => not fixable
Sep 26, 2015 12:27 pm Chris_McElligottPark Assigned To => Chris_McElligottPark
Sep 26, 2015 12:27 pm Chris_McElligottPark Status resolved => closed