IBeginDragHandler not called when cursor is locked

Hi there,

I just switched to the (new) InputSystem and I really like it so far! I experimented with the EventSystem to receive IPointerEnter and IPointerExit events by replacing the StandaloneInputModule with Class InputSystemUIInputModule | Input System | 1.4.4

For first person controllers (where the cursor is obviously locked in the center of the screen), this unfortunately only works with the aforementioned events but not with IBeginDragHandler (and Drag and EndDrag). Inspecting the InputSystemUIInputModule code i can see that it checks if the cursor is not locked and if the mouse has moved a certain distance, both of which probably false in the case of first person controllers.

is there any feasible way to make this happen? I understand that the concept of a certain moved pixel distance to trigger the onbegindrag is not applicable in 3D space, but I’d be happy with ignoring this number to receive those events.

Hi tjmaul,

I just stumbled across the same thing.
The StandaloneInputModule uses the same logic as the PointerInputModule as well as the
InputSystemUIInputModule which I was using. Seems like all of these Modules skip the drag handling for the locked cursor mode like below:

protected virtual void ProcessDrag(PointerEventData pointerEvent)
{
    if (!pointerEvent.IsPointerMoving() ||
        Cursor.lockState == CursorLockMode.Locked ||
        pointerEvent.pointerDrag == null)
        return;

    ...
   
}

A similar Issue was opened and resolved for the mouseDelta in locked cursor mode

I fear for now it’s either fork the InputSystem module or open an issue and wait…

1 Like