How to fire a event when a button is clicked ?

What im trying to accomplish is having my weapon switch by clicking/touching the button, i manage to accomplish it through keys but when trying a Event Dispatcher and Binding it wont work… im probably doing it wrong can somebody help me out. Thanks

Don’t excactly get you, but have you tried to do it from edit > project settings > input > new action input?

If you are only trying to fire an event between 2 blueprints only, event dispatcher may not be your best solution because it’s a competitively expensive operation. In that case an interface or even a direct communication with the blueprint may be best. Event dispatcher really shines best when you have multiple blueprints listening for the call.

However, for event dispatcher you need a reference to the blueprint that ‘owns’ the dispatcher. For example, if the ED is on your player controller and you are binding it on your weapon BP then on your weapon BP you need to get a reference to your custom player controller and plug it into the binds Target pin. Make sure the function/event that you bind to the ED call has the same signature as the ED call or it won’t bind.

This is the best answer I can give with the information provided. If this doesn’t help them please elaborate and possibly include screenshots.

If this did help please consider accepting the answer by clicking the check mark next to my answer. You’ll know it’s right when the answer turns green. Note: adding a comment after accepting an answer deselects it as accepted and will need to be accepted again. Thanks!

Hello thanks for the quick response, sorry if i not clear is not a actual control button is a inventory button i got in my widget game hud which i would like to use to switch the weapon instead of pressing number key, as you yo can see in the screenshot my weapon configuration is set to switch when pressing number 1 and 2 but i want to change that to my inventory button so when click or touch (since it will be a mobile game) switch the weapon.

Are you getting an error when you click the widget button?

Hello Smith, thanks for the respond i will try to do what you subject but im still a little bit confuse is not a actual control button is a inventory button i got in the widget hud instead of actual pressing a numbers key to switch weapon, use the inventory button when clicked or touch (Touchscreen mobile game ) to switch the weapon, i uploaded screenshot above thank again.

No, everything compiles without a problem but doesn’t work