Hey peeps! I’m am getting the above error in the following code.
File:FPSObjectiveActor.cpp
#include "FPSObjectiveActor.h"
#include <Runtime\Engine\Classes\Components\SphereComponent.h>
#include <Runtime\Engine\Classes\Components\StaticMeshComponent.h>
#include <Runtime\Engine\Classes\Particles\ParticleSystemComponent.h>
#include <Kismet\GameplayStatics.h>
// Sets default values
AFPSObjectiveActor::AFPSObjectiveActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
MeshComp = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComp"));
MeshComp->SetCollisionEnabled(ECollisionEnabled::NoCollision);
RootComponent = MeshComp;
SphereComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
SphereComp->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
SphereComp->SetCollisionResponseToAllChannels(ECR_Ignore);
SphereComp->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
SphereComp->SetupAttachment(MeshComp);
}
// Called when the game starts or when spawned
void AFPSObjectiveActor::BeginPlay()
{
Super::BeginPlay();
PlayEffects();
}
void AFPSObjectiveActor::PlayEffects()
{
UGameplayStatics::SpawnEmitterAtLocation(this, PickupFX, GetActorLocation());
}
// Called every frame
void AFPSObjectiveActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
void AFPSObjectiveActor::NotifyActorBeginOverlap(AActor* OtherActor)
{
Super::NotifyActorBeginOverlap(OtherActor);
PlayEffects();
}
File:FPSObjectiveActor.h
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "FPSObjectiveActor.generated.h"
class USphereComponent;
UCLASS()
class FPSGAME_API AFPSObjectiveActor : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AFPSObjectiveActor();
protected:
UPROPERTY(EditDefaultsOnly, Category = "Effects")
UParticleSystemComponent* PickupFX;
UPROPERTY(VisibleAnywhere, Category = "Components")
UStaticMeshComponent* MeshComp;
UPROPERTY(VisibleAnywhere, Category = "Components")
USphereComponent* SphereComp;
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void PlayEffects();
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
virtual void NotifyActorBeginOverlap(AActor* OtherActor) override;
};