Hello there,
So I’m having a bit of trouble looking for
UCLASS()
class MYPROJECT_API AMyActor : public AActor
{
GENERATED_BODY()
TSubclassOf<UMyClassObject> Derived1 = UMyClassObject_Derived1::StaticClass();
TSubclassOf<UMyClassObject> Derived2 = UMyClassObject_Derived2::StaticClass();
};
UCLASS(Abstract)
class MYPROJECT_API UMyClassObject : public UObject
{
GENERATED_BODY()
};
UCLASS()
class MYPROJECT_API UMyClassObject_Derived1 : public UMyClassObject
{
GENERATED_BODY()
};
UCLASS()
class MYPROJECT_API UMyClassObject_Derived2 : public UMyClassObject_Derived1
{
GENERATED_BODY()
};
My issue here is that the compiler will throw an error because the classes haven’t been defined yet.
I am aware that you use forward declarations for declaring unspecified class types. But once you attempt to initialize the variable with a class not yet defined, that method goes out the window, since the compiler has no idea what StaticClass() IS yet.
Any ideas for how to handle this? Thank you in advance