When binding a Multi Cast Delegate, what is the use differences between Add()
and AddUObject()
?
I've been using AddUObject()
on all of my bindings and they seems to work fine which has me wondering what the base Add()
version is used for.
Ive read the information on this page :
Unreal Documentation - Multicast Delegates
But I'm not quite sure the appropriate place to use each one. In what scenario would I use Add()
or AddUObject()
?
Thanks!
Add
takes in an FDelegate
.
AddUObject
is syntactic sugar for creating a templated delegate and binding it to the provided UObject, then calling Add
with the created delegate.
It is just this:
template <typename UserClass, typename... VarTypes>
inline FDelegateHandle AddUObject(const UserClass* InUserObject, typename TMemFunPtrType<true, UserClass, void (ParamTypes..., VarTypes...)>::Type InFunc, VarTypes... Vars)
{
return Add(FDelegate::CreateUObject(InUserObject, InFunc, Vars...));
}