You are not using C++ but C style cast and you can’t use a parameter as a type when casting.
Instead of all this you should use C++ casts and you can also avoid all the hardcoded numbers.
EIconStyle UGamePlay_Settings::RightArrowIconStyle()
{
TrySetSelectedIconStyle(true);
return SelectedIconStyle;
}
EIconStyle UGamePlay_Settings::LeftArrowIconStyle()
{
TrySetSelectedIconStyle(false);
return SelectedIconStyle;
}
void UGamePlay_Settings::TrySetSelectedIconStyle(const bool IncrementIndex)
{
const int8 AddIndex = IncrementIndex ? 1 : -1;
const UEnum* Enum = StaticEnum<EIconStyle>();
const uint8 CurrentValue = static_cast<uint8>(SelectedIconStyle);
if (!IncrementIndex || CurrentValue != Enum->GetMaxEnumValue())
{
const int32 CurrentIndex = Enum->GetIndexByValue(CurrentValue);
const int32 NewIndex = CurrentIndex + AddIndex;
if (NewIndex < 0) { return; }
const int64 NewValue = Enum->GetValueByIndex(NewIndex);
SelectedIconStyle = static_cast<EIconStyle>(NewValue);
}
}
SelectedIconStyle should be a member variable of type EIconStyle