How to set up event dispatchers in c++
*Note* Knew I was forgetting something at the end there, this also lets it work perfectly with blueprint, so if you have a reference to whatever actor the dispatcher/delegate is declared on, you can bind to it in blueprint like normal.
Syntax for copy paste:
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FYourDelegateType, VarType, VarName);
UPROPERTY(BlueprintAssignable, Category = "EventDispatchers")
FYourDelegateType YourDelegateName;
How to call:
YourDelegateName.Broadcast(YourParameters);
How to assign/bind:
ActorWithDelegate(point)YourDelegateName.AddDynamic(this, &YourClass::YourFunction);
Note (point) because I can't put greater or less than signs in the description. Also 'YourFunction' needs the same function signature as the delegate.
Негізгі бет UE4 c++ Event Dispatchers syntax
Пікірлер: 40