I have this class called UMyObject:
in .h
#include "Object.h"
#include "MyObject.generated.h"
/**
*
*/
UCLASS()
class MONOCHROME_API UMyObject : public UObject
{
GENERATED_BODY()
public:
UMyObject();
};
In .cpp
#include "ProjectName.h"
#include "MyObject.h"
UMyObject::UMyObject(){}
In 4.6 I could easily instantiate this class by calling in another part of the code:
UMyObject* TestObject = new UMyObject();
But now in 4.7.1 it seems I can no longer.
I get an exception error, breaking takes me here:
UObject::UObject()
{
FObjectInitializer* ObjectInitializerPtr = FTlsObjectInitializers::Top();
UE_CLOG(!ObjectInitializerPtr, LogUObjectGlobals, Fatal, TEXT("%s is not being constructed with either NewObject, NewNamedObject or ConstructObject."), *GetName());
FObjectInitializer& ObjectInitializer = *ObjectInitializerPtr;
check(!ObjectInitializer.Obj || ObjectInitializer.Obj == this);
const_cast<FObjectInitializer&>(ObjectInitializer).Obj = this;
const_cast<FObjectInitializer&>(ObjectInitializer).FinalizeSubobjectClassInitialization();
}
with this line highlighted:
check(!ObjectInitializer.Obj || ObjectInitializer.Obj == this);
Is this as intended? Because judging by 4.7’s notes, and 4.6’s notes, I’m understanding that parameter-less constructors anywhere was an intended feature, and I was able to construct UObjects this manner in 4.6.
Any help would be greatly appreciated.