Unreal Delegates
Declaring a Delegate
- DECLARE_DELEGATE(DelegateName)
- DECLARE_MULTICAST_DELEGATE(DelegateName)
- DECLARE_DYNAMIC_DELEGATE(DelegateName)
- DECLARE_DYNAMIC_MULTICAST_DELEGATE(DelegateName)
Single | Multicast | Dynamic Single | Dynamic Multicast | |
---|---|---|---|---|
How many can subscribe? | one | many | one | many |
Can use from Blueprints? | X | X | O | O |
Performance | slower than regular | slower than regular |
Use UDELEGATE for Blueprint
UDELEGATE(BlueprintAuthorityOnly)
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FInstigatedAnyDamageSignature);
Parameters & Return Value
Non Dynamic:
- DECLARE_DELEGATE_OneParam(DelegateName, Param1Type)
- DECLARE_DELEGATE_RetVal(DelegateName)
- DECLARE_DELEGATE_RetVal_OneParam(DelegateName, Param1Type) Dynamic:
- DECLARE_DYNAMIC_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
- DECLARE_DYNAMIC_DELEGATE_RetVal(DelegateName)
- DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(DelegateName, Param1Type, Param1Name)
- DECLARE_MULTICAST_DELEGATE[_RetVal, ...]( DelegateName )
- DECLARE_DYNAMIC_MULTICAST_DELEGATE[_RetVal, ...]( DelegateName )
Subscribe to a Delegate
Single
- BindLambda
- BindRaw
- BindStatic
- BindSP
- BindUFUnction
- BindUObject
- BindWeakLambda
- BindThreadSafeSP
Multicast
- AddLambda
- AddRaw
- AddStatic
- AddSP
- AddUFunction
- AddUObject
- AddWeakLambda
- AddThreadSafeSP
Dynamic Single
- BindDynamic