How to create pointer of UCLASS object with new operator?

For UObject, you shouldn’t use the new operator. Take a look at this article:

For UObjects, you use “NewObject” or “StaticConstructObject” function. Find more information here:

Then if you need a pointer to the UClass of the object, you call the object’s GetClass() func or call UItemStack::StaticClass().

1 Like