📘Unreal Engine/📝Unreal Engine

[Unreal Engine] 로그 출력 / 뷰포트 출력

주으기 2024. 5. 21. 10:18
728x90
반응형

UE_LOG

문서

https://docs.unrealengine.com/5.3/ko/logging-in-unreal-engine/

 

언리얼 엔진에서의 로깅

언리얼 엔진에서의 로깅과 관련된 정보를 살펴봅니다.

docs.unrealengine.com

 

디버깅 시 서식이 지정된 메시지를 로깅하는 매크로이다.

// UE_LOG(CategoryName, Verbosity, Value)
UE_LOG(LogTemp, Warning, TEXT("Hello World"));

 

// UE_LOG(CategoryName, Verbosity, Format, Value)
UE_LOG(LogTemp, Warning, TEXT("%s"), FString("Hello World"));

 

출력 로그

 


 

CategoryName : Output Log의 어떤 카테고리에 지정될지 정한다.

 


 

Verbosity : 로그의 상세 레벨을 정의한다. (위험한 정도?)

상세 레벨 콘솔에 출력 에디터 로그에 출력 텍스트 컬러 추가 정보
Fatal O 해당 없음 해당 없음 세션이 크래시 남
Error O O 빨간색 해당 없음
Warning O O 노란색 해당 없음
Display O O 회색 해당 없음
Log X O 회색 해당 없음
Verbose X X 해당 없음 해당 없음

 


 

Format : 데이터 타입

%s에 대응될 때는 실제 배열이 들어가는 게 아니면, 포인터 연산자를 지정해줘야 한다.

 

FString

UE_LOG(LogTemp, Warning, TEXT("%s"), *ExampleActor->GetName());

 

Bool

UE_LOG(LogTemp, Warning, TEXT("%s"), (bExampleBool ? TEXT("true") : TEXT("false")));

 

Integer

UE_LOG(LogTemp, Warning, TEXT("%d"), ExampleInteger);

 

Float

UE_LOG(LogTemp, Warning, TEXT("%f"), ExampleFloat);

 

FVector

UE_LOG(LogTemp, Warning, TEXT("%s"), *ExampleVector.ToString());

 

여러 포맷

UE_LOG(LogTemp, Warning, TEXT("%s, %f, %d"), *ExampleVector.ToString(), ExampleFloat, ExampleInteger);

 

 


 

 

AddOnScreenDebugMessage

로그 메시지를 화면에 출력하는 함수이다.

 

if (GEngine)
{
	GEngine->AddOnScreenDebugMessage(0, 10.f, FColor::Blue, FString("OnScreenDebugMessage"));
}

 

첫 번째 인자 : Key 값

두 번째 인자 : 출력 시 화면에 남아있는 시간

세 번째 인자 : 출력 메시지 색상

네 번째 인자 : 출력 메시지

 

 

 

 

 

728x90
반응형