Unreal editor says:
Source/MyProject/Public/DeathComp/DeathComponent.h(26) : Error: Unrecognized type ‘AMainCharacter’ - type must be a UCLASS, USTRUCT or UENUM
Code from DeathComponent:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "DeathComponent.generated.h"
class AMainCharacter;
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class MYPROJECT_API UDeathComponent : public UActorComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UDeathComponent();
protected:
// Called when the game starts
virtual void BeginPlay() override;
UPROPERTY()
AMainCharacter* MainCharacter;
public:
UFUNCTION(BlueprintCallable)
bool GetDeath() const { return MainCharacter->IsDead; };
};