For an object derived from UObject I’m using NewObject<>() and assign its members using a separate Init() function. I don’t like it (e.g. I’d like to use const members assigned at construction time), but this seems to be the way to go. When using UCLASS() and GENERATED_BODY() and define a custom constructor with parameters, I get the compilation error:
error C2338: You have to define MyUObject::MyUObject() or MyUObject::MyUObject(const FObjectInitializer&). This is required by UObject system to work correctly.
Now, when I derive from UObject and omit the usage of UCLASS()/GENERATED_BODY() and using whichever constructors I like, the program compiles fine. Instantiating also seems to work, however when I try to assign that object, the compilation fails b/c UObject::UObject(const UObject &) already defines the copy constructor.
So I’m stuck to NewObject<>(), however that function does not allow to pass arguments to the objects constructor. Is that correct?
Is it meaningful to add my own copy constructor in MyUObject or would that mitigate the functionality of UObject?
Is it meaningful to omit UCLASS()/GENERATED_BODY()?
Thanks in advance!