Hello i m starting Unreal Engine and i have a problem
I dont understand how make my UCameraComponent visible in my child class
I have a character class and a weapon class and i want access camera in weapon class so
In character.cpp
// Sets default values
ASCharacter::ASCharacter()
{
SpringArmComp = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComp"));
SpringArmComp->bUsePawnControlRotation = true;
SpringArmComp->SetupAttachment(RootComponent);
CameraComp = CreateAbstractDefaultSubobject<UCameraComponent>(TEXT("CameraComp"));
CameraComp->SetupAttachment(SpringArmComp);
}
characterr.h
Normaly i have
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category= "Components")
UCameraComponent* CameraComp;
So i change it for :
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category= "Components")
UCameraComponent* CameraComp;
and for me in weapon.cpp i just need call
FVector CameraForward = FVector(CameraComp->GetForwardVector());
but CameraComp is not available
So what is the good way ?
Thanks for your help