Delegates - barsandcat/HMS-Sunflower GitHub Wiki

https://dev.epicgames.com/documentation/en-us/unreal-engine/delegates-and-lamba-functions-in-unreal-engine?application_version=5.5 Delegate is a callable. Delegate type is function signature. Delegate requires initialization - "bind" to something else callable, i.e. its a wrapper. If you are wrapping reference to UObject with delegate, you can check if it is alive before executing delegate. Delegates support std::bind functionality

Unreal handles 4 types of delegates:

Non dynamic/Single

DECLARE_DELEGATE -> TDelegate Functor that can have return

Non dynamic/Multicast

DECLARE_MULTICAST_DELEGATE, DECLARE_EVENT ->TMulticastDelegate Multicast is array of functors with no returns

Dynamic/Single

DECLARE_DYNAMIC_DELEGATE ->TBaseDynamicDelegate Dynamic delegates are actually completely different breed, the need to be checked if bound before calling, they are slow, but support "serialization", and can be called by name? Finally, only dynamic delegates can be exposed to blueprints.

Dynamic/Multicast

DECLARE_DYNAMIC_MULTICAST_DELEGATE -> TBaseDynamicMulticastDelegate

⚠️ **GitHub.com Fallback** ⚠️