I am trying my hand at delegates in Unreal for the first time and I just cannot seem to get the syntax right. Any help would be greatly appreciated, thank you.
Class1.h
DECLARE_MULTICAST_DELEGATE(ON_LANGUAGE_CHANGE);
Class1
{
private:
ON_LANGUAGE_CHANGE LanguageChangeDelegate;
}
Class1 cpp
void Class1::AFunction(FString target)
{
LanguageChangeDelegate.Add(this, &Class2::ADifferentFunctionInClass2, (FString)target);
if (LanguageChangeDelegate.IsBound())
{
LanguageChangeDelegate.Broadcast(target);
}
}