Allow Setting/Releasing of Mouse Capture in Blueprints

Currently, there is no way to set capturing of the mouse in Blueprints aside from responding to a Pointer Event.

This makes it impossible to capture the mouse unless you’re already responding to a mouse event, which sometimes is simply too late (especially when the mouse is over a different widget, in which case even this becomes impossible to handle through any Blueprint means without creating a ‘full screen mouse shield’).

It would be nice if the Widget Blueprint Library included ways to set mouse capture. Also, as a side note, it’d be nice to be able to set mouse capture on Key events as well, i.e. OnKeyDown. Currently this results in a crash.

Bump. I just hit very same limitation. I wanted to capture cursor when rotating camera in RTS game with mouse while holding keyboard button. Blueprint have input modes exposed which are something like presets for all these settings but It would be definitely handy to have individual settings available.

1 Like

I know this is an old topic, but I’m hitting the same limitation. I’d really like to be able to release mouse capture with a key while playing my game, especially for testing. Right now, I can’t figure out how to debug blueprints while being able to make use of the screen edge scrolling in my game.

Using SetViewportMouseCaptureMode doesn’t work - it has no effect.

Hey, I made a video and wrote an article sharing my experience and solution to this problem.

Toggling cursor visibility, mouse capture mode and locking to a viewport inside of Unreal Engine 5 - YouTube

Toggling cursor visibility, mouse capture mode and locking to a viewport inside of Unreal Engine 5 via Blueprints – Brock Harrison Austin Barnett (brockbarnett.me)