Hello Friends,
I’m currently trying to bind a UFunction to a UImage that I create on runtime.
I would like to bind an aactor to the UImage input function, but cannot figure out how to pass that reference on runtime…
Does anyone know how to append an object reference to .BindUFunction?
Subsequently, I think I could work around this if I knew how to get the name of the widget that was clicked from c++.
Thank you for your time!
Here’s my current code:
void MyClass::CreateBlips() {
int i = 0;
for (AActor* Actor: AllActors) {
UImage *newBlip= DuplicateObject<UImage>(originalBlip, this, FName(TEXT("%d"),i));
newBlip->OnMouseButtonDownEvent.BindUFunction(this, FName("BlipMouseDown"));
i++
}
}
FEventReply MyClass::BlipMouseDown(FGeometry geo, const FPointerEvent& fevent, AActor* MyActor)
{
//get according actor referenced to clicked uImage
UE_LOG(LogTemp, Warning, TEXT("Actor corresponding to blip is %s"), *MyActor->GetName());
return FEventReply(false);
}