Download

Delegates - Can the same class broadcast and listen?

Hello,

Fairly new to c++ in unreal. Currently working on moving over some stuff from blueprint to c++.

I have a Pawn class which I want to be able to broadcast and listen to an event. I have several of these Pawns running during game-play when a new one is activated I want the others to know about it.

I am using a Dynamic Multicast Delegate. Through testing the broadcasting is working fine, however when I try to make the same class also bound to listening as well I am getting syntax errors.

​​​​​​Perhaps there is a better way to approach this?

Any UFunction from a valid UObject can listen to a dynamic delegate, doesn’t matter which class it is.
You just have to make sure the function you bind has the exactly same parameter signature your delegate has, if signature differs then you get syntax errors.

Thanks for the help! The function I was trying to bind to returned AActor, I changed it to return void and it worked.