Like this:
.h
UENUM(BlueprintType)
enum class ESpecialSkillTypes : uint8
{
SS_None UMETA(DisplayName = "None"),
SS_Surgeon UMETA(DisplayName = "Surgeon"),
SS_Interpreter UMETA(DisplayName = "Interpreter"),
SS_Botanist UMETA(DisplayName = "Botanist"),
SS_Technician UMETA(DisplayName = "Technician"),
SS_Boaster UMETA(DisplayName = "Boaster"),
SS_Athlete UMETA(DisplayName = "Athlete"),
SS_ToughGuy UMETA(DisplayName = "ToughGuy"),
SS_Marksman UMETA(DisplayName = "Marksman"),
SS_LuckyDevil UMETA(DisplayName = "LuckyDevil"),
SS_TotalCount
};
ESpecialSkillTypes GetRandomSpecialSkill();
.cpp
ESpecialSkillTypes GetRandomSpecialSkill()
{
int r;
r = FMath::RandHelper(ESpecialSkillTypes::SS_TotalCount-1);
return ESpecialSkillTypes(r);
}
Also, with enum class there’s no need for prefixes in your enums, since you have to use the enum class name to access them so there’s no collision, so it’s fine to use this:
UENUM(BlueprintType)
enum class ESpecialSkillTypes : uint8
{
None,
Surgeon,
Interpreter,
Botanist,
Technician,
Boaster,
Athlete,
ToughGuy,
Marksman,
LuckyDevil,
TotalCount
};
ESpecialSkillTypes GetRandomSpecialSkill();