USpringArmComponent & UCameraComponent undefined

Hi, I’m new to Unreal but have experience programming in C++ which is why I started to follow the tutorials listed [here][1]. However when following this tutorial I’m having problems declaring the spring arm and camera components for the pawn class with the intelisense claiming these are undefined even though I’m following word for word the tutorial. Is there something I’m missing with this?

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "PawnwithCamera.generated.h"

UCLASS()
class RTS_API APawnwithCamera : public APawn
{
	GENERATED_BODY()

public:
	// Sets default values for this pawn's properties
	APawnwithCamera();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

protected:
	UPROPERTY(EditAnywhere)
	USpringArmComponent* cameraSpringArm;
	UCameraComponent* camera;
	
};

Hey, can you make sure you understand this post and report back if you have more questions? <3

I believe it is just because you haven’t mentioned them as a class it should read

class UCameraComponent* camera;

instead of

UCameraComponent* camera;

if it isn’t that please make sure you’re actually including:

#include "Camera/CameraComponent.h"

For anyone who would still like an answer to this question, make sure to include the header file for the Spring Arm and Camera components.

#include "Classes/GameFramework/SpringArmComponent.h"

#include "Classes/Camera/CameraComponent.h"
1 Like