How it works...

Instantiating a UObject class using NewObject is simple. ConstructObject will instantiate an object of the blueprint-class type, and return a C++ pointer of the correct type.

Unfortunately, NewObject has a nasty first parameter that requires you to pass GetTransientPackage() with each call.

Do not use the keyword new when constructing your UE4 UObject derivative! It will not be properly memory-managed.

For more information on  NewObject  and other object creation functions, check out  https://docs.unrealengine.com/en-us/Programming/UnrealArchitecture/Objects/Creation.