How to track mouse button release idependently from object?

I can track mouse button release when
it was performed above the object

The Actor On Clicked I presume.

Is it possible in blueprints?

Yes, you can do in the player controller. Call the dispatcher on release. Any actors that need to know about the release can register with it at begin play like so:

I can track mouse button release when it was performed above the object, but I need to track it when it’s not hover any object. Is it possible in blueprints?

Ok, but how to get to the player controller and call this dispatcher?
Thanks!

Create the dispatcher in the PC and drag it to the graph like so, Call:

It’s a custom Player Controller. And no, this should be in the Player Controller as mentioned in my original post.

More info about the PC and setting up the Game Mode - you will need it. Once you have the Game Mode, you can add the Player Controller.


Alternatively, you could do the above in the Pawn or Character instead - it will work well there, too. Especially if you’re not planning on having different controllable Pawns with different movement methods.

In this case, you’d get Pawn → Cast to YourPawn.

What is “NS_PlayerController”? I can’t cast to it. Is this should be made in Level blueprint?

Thanks for your time man!

Is it really necessary? I mean, it’s common mechanics and everyone knows that if you press the button but then move the cursor away and release the button, it won’t be clicked. It will be like punishing users for mistakes.

People fall into the trap of using Actor On Clicked because it’s easier to implement than Get Hit Under Cursor or a proper Line Trace - especially when you do not know how to propagate data.

The click happens inside the actor so there’s no need to do anything else, it just works (albeit poorly in most cases, limiting severely what you can achieve with it) - the method would be more useful providing one could, optionally, force a Precise Click akin to UMG’s buttons.

I guess this method has its uses (I use it exclusively for in-game debug) but it is awkward, especially that this click is handled by the player controller - which is both a curse and a blessing at times.

Ok, so I’ve created custom Player Controller and created dispatcher there.
Also I’ve selected this custom controller in “Player Controller Class” in Game Mode.
In level blueprint I’ve made a blueprint like you’ve shown in your first message.
But then when I’m launching a build, I see the mouse cursor only until I click. Just after first click it disappears. What could be the issue?

If what you said apply to UI then you absolutely right. But it’s not the case.

In the player controller, have a look at the class defaults:

The Show Mouse Cursor is what you want, most likely.

Holly sh… It works!! Thank you man! Sending a rays of happines to you! :slight_smile: