Call a function when button clicked

I stuck with a very simple thing.

I made a Widget with a Button. I have two cameras in my Pawn and want to use this button to change the camera.

On my Pawn i made a EventDispatcher “WechselKamera”

How can i fire this Event “WechselKamera” from my Widget Button?

I am sure this is very simple, but i can’t wind the answer in the documentation and youtube tutorials.

Thanks for your help!

You’ll want to get that controlled pawn, most likely through the Player Controller, and then cast from that Controlled Pawn to the WeschelKamera event. Then, when the OnClicked event occurs, it will call that event with the CranePawn as its target, and you should be in business.

PlayerController > Get Controlled Pawn > Cast to Controlled Pawn > WechselKamera (message)

I’m not at my home computer at the moment so I can’t test this, but that should work.

Cheers :slight_smile:

Thanks a lot TBWright.

That works for me. This is what i added on the Button:

Good to hear! Glad I could help =]