If you are trying to create an new AActor you must Spawn the actor itself. Spawning will put the actor physically in the level you are in. The following is an example:
FActorSpawnParameters SpawnInfo;
// Spawninfo has additional info you might want to modify such as the name of the spawned actor.
AMyActor* MyActor = GWorld->SpawnActor<ACloudCubeNative>(ACloudCubeNative::StaicClass(), SpawnPosition, FRotator::ZeroRotator, SpawnInfo);
if (MyActor != NULL)
{
// Actor has been spawned in the level
}
else
{
// Failed to spawn actor!
}
If in turn you would like to create a new UObject class you must construct the class itself:
// For older UE versions (Pre 4.9) you may use `ConstructObject` instead
UMyObject* MyObject = NewObject<UMyObject>(UMyObject::StaticClass());
if (MyObject != NULL)
{
// Object has been created!
}
else
{
// Failed to create object
}
If you would like to just create a new instance of a class that is neither an AActor or an UObject you use the standard new/delete keywords as in C++:
// Case 1: Single pointer
MyClass * pt = new MyClass;
delete pt;
// Case 2: Array of pointers
MyClass * pt;
pt = new MyClass[3];
delete[] pt;
Just as a side note, there are many different overload methods for SpawnActor and Construct object. I have posted the most common cases but you should check the API to what you can use and what not.
Cheers,
Moss