Getting ready
Instantiating UObject-derived classes that are not AActor class derivatives does not use UWorld::SpawnActor< >. Instead, we have to a special global function: ConstructObject< > or NewObject< >. Note that you should not use the bare C++ keyword new to allocate new instances of your UE4 UObject class derivatives.
You will need at least two pieces of information to properly instantiate your UCLASS instance:
- A C++ typed UClass reference to the class type that you would like to instantiate (blueprint class)
- The original C++ base class from which the blueprint class derives