Hello, so I am trying to follow along the UE4 programming tutorial videos and I’m only on the second video and already getting an error and I’m not sure why its an error.
I’m working on the pickup source file and I have exactly what the instructor has on her screen:
#include "TutorialCode.h"
#include "Pickup.h"
APickup::APickup(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
//the pickup is valid when it is created
bIsActive = true;
//Create the root SphereComponent to handle the pickup's collision
BaseCollisionComponent = PCIP.CreateDefaultSubobject<USphereComponent>(this, TEXT("BaseSphereComponent"));
//Set the SphereComponent as the root component
RootComponent = BaseCollisionComponent;
//Create the static mesh component
PickupMesh = PCIP.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("PickupMesh"));
//Turn physics on for the static mesh
PickupMesh->SetSimulatePhysics(true);
//Attach the StaticMeshComponent to the root component
PickupMesh->AttachTo(RootComponent);
}
//Must add _Implementation if the function is a blueprint native event
void APickup::OnPickedUp_Implementation()
{
//There is no default behavior for a Pickup when it is picked up.
}
Except I am getting an error that says:
1>D:\UnrealProjects\TutorialCode\Source\TutorialCode\Pickup.cpp(21): error C2065: ‘PickupMesh’ : undeclared identifier
Any idea why this is happening?
Edit: the error is actually on line 19 above