박하의 나날

UE4 디버그 메세지

프로그래밍/Unreal

1.

1
2
3
4
5
void AMyClass::Debug(int slot, FColor color, FString mess){
    if (GEngine){
        GEngine->AddOnScreenDebugMessage(slot, 5.f, color, mess);
    }
}
cs
1
2
3
void MyClass::Test_Message(){
    Debug(0, FColor::Cyan, "TEST DEBUG MESSAGE");
}
cs

 

2.

1
2
UE_LOG(LogTemp, Warning, TEXT("HP = %d"),hp); 
UE_LOG(LogTemp, Error, TEXT("TEST DEBUG MESSAGE"));
cs

 

3.

1
2
int hp = 30;
FString NewString = FString::FromInt(hp);
cs

또는 Int를 String으로 변환해서 출력.