Hello, I’ve been following the tutorial here
https://docs.unrealengine.com/latest/INT/Programming/Tutorials/PlayerCamera/4/index.html
and when recreating the code with a few adjustments, and it compiles fine. When running the program in the UE, I get an error through the editor that says
“root component cannot be attached to other components in the same actor. Aborting.”
I believe the problem is within this bit of code from the tutorial, and this part was unedited when putting it into my program and still doesn’t work.
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
testMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TestMesh"));
OurCameraSpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraSpringArm"));
OurCameraSpringArm->SetupAttachment(RootComponent);
OurCameraSpringArm->SetRelativeLocationAndRotation(FVector(0.0f, 0.0f, 50.0f), FRotator(-60.0f, 0.0f, 0.0f));
OurCameraSpringArm->TargetArmLength = 400.f;
OurCameraSpringArm->bEnableCameraLag = true;
OurCameraSpringArm->CameraLagSpeed = 3.0f;
OurCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("GameCamera"));
OurCamera->SetupAttachment(OurCameraSpringArm, USpringArmComponent::SocketName);