Hello,
I am trying to do a simple “Trigger” for a PointLight, this is my first C++ Code, but it doesnt compile (Error LNK2019/LNK2001) . Anyone know a solution?
Trigger.cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "Trigger.h"
#include "Components/PointLightComponent.h"
// Sets default values
ATrigger::ATrigger()
{
// 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;
PointLight = CreateDefaultSubobject<UPointLightComponent>("Lighti");
}
// Called when the game starts or when spawned
void ATrigger::BeginPlay()
{
Super::BeginPlay();
PointLight->bVisible = true;
}
// Called every frame
void ATrigger::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
Trigger.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/PointLightComponent.h"
#include "Trigger.generated.h"
UCLASS()
class FORESTCP_API ATrigger : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ATrigger();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
UPROPERTY(VisibleAnywhere)
UPointLightComponent* PointLight;
UFUNCTION()
void ToggleLight();
};