Hi, I’m having trouble getting Uproperty to work for a pawn. when I try to build and run my code commenting UPROPERTY() out everything runs fine but when UPROPERTY is not commented my code fails and it seems that it is not defined. I’m trying to follow this tutorial on youtube. I think I need to include something but I don’t know what, looking at the documentation isn’t helping me. here is the code:
// Fill out your copyright notice in the Description page of Project Settings.
// able to read input
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "PlayerCam.generated.h"
UCLASS()
class TUTORIAL_API APlayerCam : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
APlayerCam();
UPROPERTY(EditAnywhere);
UStaticMeshComponent* CubeMesh;
UPROPERTY(EditAnywhere);
class UCameraComponent* Cam;
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;
void MoveForward(float Value);
void MoveRight(float Value);
};