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:
DECLARE_DELEGATE
-> TDelegate
Functor that can have return
DECLARE_MULTICAST_DELEGATE
, DECLARE_EVENT
->TMulticastDelegate
Multicast is array of functors with no returns
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?
DECLARE_DYNAMIC_MULTICAST_DELEGATE
-> TBaseDynamicMulticastDelegate