본문 바로가기

카테고리 없음

unreal ConsoleVariable

가급적 UE_BUILD_SHIPPING로 감싸주는게 좋다

 

등록하기

#if !UE_BUILD_SHIPPING
static TAutoConsoleVariable<int32> CVarTestItemGrade(
TEXT("CVar.TestItemGrade"),
0,
TEXT("Normal=1, High=2, Epic=3, Hero=4, Legend=5, Unique=6, Premium=7"),
ECVF_Default);
#endif


사용은 이렇

#if WITH_EDITOR
int32 TestGradeValue = DDConsoleVariable::CVarTestItemGrade.GetValueOnGameThread();

if (TestGradeValue > static_cast<int32>(EGrade::None) && TestGradeValue < static_cast<int32>(EGrade::Max))
{
GradeValue = static_cast<EGrade>(TestGradeValue);
}
#endif