I am simply trying to create an array of actors, my .h file is just:
UCLASS()
class ROBOTS_API ABaseRobot : public ACharacter
{
public:
GENERATED_BODY()
ABaseRobot(const FObjectInitializer &objInit);
UPROPERTY(EditDefaultsOnly, Category = "Joints")
TArray<class AActor* > joints;
UPROPERTY(EditDefaultsOnly, Category = "Heart")
class UStaticMeshComponent *heart;
};
and my .cpp is just:
ABaseRobot::ABaseRobot(const FObjectInitializer &objInit)
: Super(objInit)
{
heart = objInit.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh Comp"));
joints.Init(5);
joints[0] = objInit.CreateDefaultSubobject<AActor>(this, TEXT("Joint 1"));
joints[1] = objInit.CreateDefaultSubobject<AActor>(this, TEXT("Joint 2"));
joints[2] = objInit.CreateDefaultSubobject<AActor>(this, TEXT("Joint 3"));
joints[3] = objInit.CreateDefaultSubobject<AActor>(this, TEXT("Joint 4"));
joints[4] = objInit.CreateDefaultSubobject<AActor>(this, TEXT("Joint 5"));
heart->AttachParent = RootComponent;
}
I get an unhandled exception “exited with code 0 (0x0)” every time I compile, I have been looking for similar problems for hours but have not been able to find any. I just can’t figure out what the problem is, any help would be appreciated. Thanks!