// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Character.h"
#include "CharBase.generated.h"
UENUM(BlueprintType)
enum class EStat : uint8
{
ATTACK UMETA(DisplayName = "Attack"),
DEFENSE UMETA(DisplayName = "Defense"),
HEALTH UMETA(DisplayName = "Health"),
DODGE UMETA(DisplayName = "Dodge"),
AGILITY UMETA(DisplayName = "Agility")
};
UCLASS()
class TERRAIN_API ACharBase : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
ACharBase();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};
Ok I found that I need to put the enum in a class and reference it through the class. Using the code below I can now use the Enum in the TMap key value by.
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "GameFramework/Character.h"
#include "CharBase.generated.h"
UCLASS()
class TERRAIN_API ACharBase : public ACharacter
{
GENERATED_BODY()
public:
UENUM(BlueprintType)
enum class EStat : uint8
{
ATTACK UMETA(DisplayName = "Attack"),
DEFENSE UMETA(DisplayName = "Defense"),
HEALTH UMETA(DisplayName = "Health"),
DODGE UMETA(DisplayName = "Dodge"),
AGILITY UMETA(DisplayName = "Agility")
};
// Sets default values for this character's properties
ACharBase();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
};