March 2019
Intermediate to advanced
708 pages
17h 9m
English
So, you've constructed some custom UCLASS, intended for use inside UE4. We created one in the editor using blueprints in the previous recipe, but how do you instantiate them in C++? Objects in UE4 are reference-counted and memory-managed objects, so you should not allocate them directly using the C++ keyword new. Instead, you'll have to use a function called ConstructObject so that we can instantiate your UObject derivative.
ConstructObject doesn't just take the C++ class name of the object you are creating; it also requires a blueprint class derivative of the C++ class (a UClass* reference). A UClass* reference is just a pointer to a blueprint.
How do we instantiate an instance of a particular ...
Read now
Unlock full access