Hi, I’m trying to do a simple thing, adding a property or type AActor* to my Actor (Camera Director) so I can set the camera… Based on the tutorial from Epic Games.
This is the .h file
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "CameraDirector.generated.h"
UCLASS()
class KW_IN_SPACE_API ACameraDirector : public AActor
{
GENERATED_BODY()
public:
ACameraDirector();
protected:
virtual void BeginPlay() override;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
AActor* TopDownCamera;
};
And this is the .cpp file:
#include "CameraDirector.h"
#include "Kismet/GameplayStatics.h"
ACameraDirector::ACameraDirector()
{
PrimaryActorTick.bCanEverTick = false;
APlayerController* PlayerController = UGameplayStatics::GetPlayerController(this, 0);
UE_LOG(LogTemp, Warning, TEXT("This a testing statement. %s"), *PlayerController->GetName());
PlayerController->SetViewTarget(TopDownCamera);
}
void ACameraDirector::BeginPlay()
{
Super::BeginPlay();
}
From what I understand this should work and yet I don’t see the option to set TopDownCamera in the details when I drag this to the editor (I see the instance in the world components view).
HELP PLEASE