Exception raised when Shift+dragging under the new Input System

Issue #185 resolved
Joe Flood created an issue

Dragging of the console window does not work under the new Input System, because the code in DraggableUI.cs uses Input.mousePosition (around line 40) - which throws an exception each frame that a drag is attempted. The correct code under new Input System should be (I think) Mouse.current.position.ReadValue(), which should be a drop-in replacement.

I couldn’t find any other use of Input.* in the code, but there may be other examples of this potentially!

Comments (2)

  1. Joe Flood reporter

    In case it helps, here’s how I fixed it locally…

    Add this to InputHelper.cs:

            public static Vector2 GetMousePosition()
            {
    #if NEW_INPUT
                return Mouse.current.position.ReadValue();
    #else
                return Input.mousePosition;
    #endif
            }
    

    and change DraggableUI.cs, line 40 to read:

    Vector2 pos = InputHelper.GetMousePosition();

  2. Log in to comment