Unity UI - Input.mousePosition changed to custom mouse position

Hi everyone & once again thanks to UT for the new UI system.

Today, I’ve tried modifying the UI source (namely PointerInputModule) to support different mouse position than the default “Input.mousePosition”, because I need to set sensitivity to my cursor. I’ve got Screen.lockCursor set to true, so the Event System could not recognize my custom cursor hovering around. Thus…

This is the code I’ve added, then I’ve replaced all occurrences of Input.mousePosition for MousePosition.mousePosition, built the solution and imported the dll’s. The code works, and I think it can be useful to others, possibly the concept can be integrated into the UI system.

Do you guys think it is a good solution? Thanks, and enjoy :slight_smile:

public static class MousePosition {
//our own mouse position we can modify  from our own scripts
           
            static Vector2 _mousePosition;
           
            public static Vector2 mousePosition
            {
                get
                {
                    return _mousePosition;
                }
                set
                {
                    _mousePosition = value;
                }
            }
           
        }

Eh, so whie this works while running in the editor, my custom cursor doesn’t move when the game is built on mac :frowning:
Might need a second look.

Ok, so I realized I didn’t copy all DLL’s correctly into the Unity folder structure :slight_smile: While this code works, there might be a better way to do this, so feel free to let us know. Thanks.

Also If this seems like a good idea, anyone who’s able to propose this as a feature to the main unity ui code branch, go ahead, I won’t be able to look into it very soon. Thanks.