NewObject And StaticClass() argument

Hello,

When creating New Objects you always have to provide inputs.
Usually the fist argument is the “Outer” class. Which is the class that created the object.

GetWorld() basically runs along the Outer classes untill it finds the world.
It’s defined as this in UObject:

// UObject::GetWorld() implementation
if (UObject* Outer = GetOuter())
{
    return Outer->GetWorld();
}

So you always need to pass in an object as the first parameter when calling NewObject();

Regarding the question to ::StaticClass(), that will be used when defining the type of object / class to create.
So leaving it empty will Create a normal UObject, but passing in UObjectB::StaticClass() will create a UObjectB object.

~ Dennis “MazyModz” Andersson