CreateDefaultSubobject
is a template function. The argument in the angles is the type argument required by that template function.
You can open up the definition of that function in the editor – select it and press F12. Then you can see how it’s implemented.
template<class TReturnType>
TReturnType* CreateDefaultSubobject(FName SubobjectName, bool bTransient = false)
{
UClass* ReturnType = TReturnType::StaticClass();
return static_cast<TReturnType*>(CreateDefaultSubobject(SubobjectName, ReturnType, ReturnType, /*bIsRequired =*/ true, bTransient));
}
You will note that it gets the UClass
that goes with the type you want, and pass that along to a non-template overload of CreateDefaultSubobject()
, and then casts the returned value to the type you requested.
Googling for “C++ template function” and “function overload” will hopefully find a variety of references you can use to read more about this. It’s used all over, so pretty important to learn!