Bind event not compiling in blueprints

Hi,

I a new to Unreal development. I’m using blueprints for my AI and I hope you can point me in the right direction for my problem.

I work with an AIPerception Component.
When I bind a custom event to the OnTargetPerceptionUpdated event dispatcher → it compiles.
When I bind a custom event to the OnTargetUpdated event dispatcher → it doesn’t compile and gives me the message “Event signature error. Function not compatible”.

Is this a bug in the engine ? Or is there a concept I don’t get ?

ue version : 4.10.3 on windows

1 Like

What type of array argument is?

It is an array of Actor.

It is super easy to reproduce :
I created the custom event with a simple drag and drop from the “Bind Event to OnPerceptionUpdated” box.

I am getting this too, except the parameter is an array of uclass pointers. my delegate declaration: Screenshot - a6ec9e8273fb4d97d431d6994eb8b67d - Gyazo

I believe the problem here is blueprints use references, so the fix would be to change the delegate parameter type from

TArray<AActor*>

to

TArray<AActor*>&

However, this introduces another error, because delegate parameters must be const. again, there is a simple fix for this:

const TArray<AActor*>&

So for example, my final delegate declaration is this:

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FSelectionChanged, const TArray<UClass*>&, SelectedUnits);

Hope this helps,

Kieran

2 Likes