Assign function to event

Hello.

I have some UserWidget, that contains ColorPicker and some function.

I am want to bind function to the ColorPicker, but my function is not in functions list of the CreateEvent object.

How to bind my function to ColorPicker object?

Thank you!

Where does this function exist?

Please, look at first picture - function is in the same UserWidget, that contains ColorPicker and binding code.

Well for one you can’t make custom events inside of functions so that would be a start.

-Drag a wire off from Event (red square), and type in the searchbox “Custom Event”. Click the result that pops up and you got yourself a new event. You can then just call your function from that event’s implementation. You can only do that from the EventGraph though. If you want to bind an event inside another function you need to create the event by hand on the base graph and then reference it inside the function.

The solution was very simple.

ColorPicker returned Linear Color Structure, but by ref. My function has input parameter Linear Color Structure (not by ref).

To fix it, I edited Plugins\VictoryUMG\Source\VictoryUMG\Public\JoyColorWheel.h - intead of

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnJoyColorChangedEvent, const FLinearColor&, NewColor);

I made

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnJoyColorChangedEvent, const FLinearColor, NewColor);

After that I was able to connect my function to CreateEvent and bind it to the ColorPicker.