Bind function to certain actors in the scene in c++

Hello, I’m looking for a way to bind OnBeginCursorOver event to certain actors in the scene.
Currently I’m trying it by going through the taged actors I need, in the BeginPlay function (also tried in the constructor) of my character and then add the event with a linked function but it seems that I can’t add an function with AddDynamic. The error can be seen in the picture.

Does someone know how I could accomplish this, so that I don’t need to raytrace with mouse position?

The problem I had when I got this message was that the function signature didn’t match what unreal expected. Are you sure your CustomOnBeginMouseOver function matches the one it expects?

The function I’m using is
void AGameController::CustomOnBeginMouseOver(UPrimitiveComponent* TouchedComponent)
It is the only example I found and and it seemed to work.

You might need to switch the UPrimitiveComponent* to an AActor* in your function

Thanks, that was the solution!