My Code:
// .h
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Components")
UCameraComponent* FPPCameraComp;
// .cpp
FPPCameraComp = CreateDefaultSubobject<UCameraComponent>(TEXT("FPPCameraComp"));
FPPCameraComp->SetupAttachment(GetCapsuleComponent());
// Position the camera slightly above the eyes.
FPPCameraComp->SetRelativeLocation(FVector(0.0f, 0.0f, 50.0f + BaseEyeHeight));
//FPPCameraComp->
FPPCameraComp->SetupAttachment(GetMesh());
But then it says “cannot change socket on inherited components”
Screenshot:
[SPOILER]
[/SPOILER]
How can I do it in C++?