Right mouse clickable button

How to make a right mouse clickable button???

I tried with custom C++ UButton/SButton inheriting class but seems like a pain in the as*. I’ve replaced my Blueprint UButton with a checkbox + OnMouseButton event handler overriden with proper blueprint flow, but seems like calling SetCheckedState does not update the visual. I’ve ended up with a piece of blueprint that calls some custom events but I’m still unable to reflect the UI componet visual correctly (pressed state). It’s stunning that version 5 of the engine capable of insane 3D graphics lacks such a feature!

What is the aim? I’m trying to rewrite classic Fallout 2 with UE5 and I’ve came to a moment I need to switch between aimed/non-aimed attacks which involves right-mouse-button clicking the same UI element used to actually attack. Please help!

Not sure what exactly you trying to do but depends. As far as I understood you don’t have to inherit SButton/UButton for that actually.

OnWidget->OverrideFunction->MouseButtonDown and resolve over the function if button action is your action which is RMB.


Resolve its Event with a condition.

Something like this or you can query enhanced input subsystem for action which would be better.

Furthermore if there is an action already triggering a system, (in your case AimedAttack), after that this is just a state or event. You can make a GetAttackState() from somewhere or OnAttackStateChanged to drive the UI side. Since in my opinion If this is not UI driven but input driven system, UI can be just a listener.