Add UI Slider Event Binding to Function from C++?

Hello Friends,

I’m a bit of a ue4 noobie and am wondering how to bind a USlider event to a function in C++?
Specifically how would I add a function to the OnValueChanged event? (see picture below for context)

I would assume the code would look something like this? (of course this doesn’t work and I’m diving through the c++ api documentation but am still somehow stumped)

MM_CutLayerSlider->OnValueChanged.AddDyanmic(this, &MyClass::MyOnValueChangedFunction);

Thank you for your time!

A bit late to the reply but, it helps to look at the engine here. You’re initializing it correctly but, the delegate calls for an input so it should look like:

bool UMyClass::Initialize()
{
MM_CutLayerSlider->OnValueChanged.AddDyanmic(this, &MyClass::MyOnValueChangedFunction);
}

void UMyClass::MyOnValueChangedFunction(float Value)
{
}

2 Likes