UE的几种输出方式

UE的几种输出方式

Log

1
2
3
4
5
6
UE_LOG(LogTemp, Log, TEXT("This is a log message."));
UE_LOG(LogTemp, Warning, TEXT("This is a warning message."));
UE_LOG(LogTemp, Error, TEXT("This is an error message."));

FString MyString = TEXT("Hello, World!");
UE_LOG(LogTemp, Log, TEXT("MyString: %s"), *MyString);

Debug Draw

1
2
3
4
5
6
7
8
9
10
11
12
13
14
void DrawDebugSphere(UWorld* World, FVector Center, float Radius, int32 Segments, FColor Color, float LifeTime = 0.0f, uint8 DepthPriority = 0, bool bPersistentLines = false)
{
DrawDebugSphere(World, Center, Radius, Segments, Color, bPersistentLines, LifeTime, DepthPriority);
}

void DrawDebugLine(UWorld* World, FVector LineStart, FVector LineEnd, FColor Color, bool bPersistentLines = false, float LifeTime = 0.0f, uint8 DepthPriority = 0, float Thickness = 0.0f)
{
DrawDebugLine(World, LineStart, LineEnd, Color, bPersistentLines, LifeTime, DepthPriority, Thickness);
}

void DrawDebugPoint(UWorld* World, FVector Position, float Size, FColor Color, bool bPersistentLines = false, float LifeTime = 0.0f, uint8 DepthPriority = 0)
{
DrawDebugPoint(World, Position, Size, Color, bPersistentLines, LifeTime, DepthPriority);
}

输出到屏幕上

1
GEngine->AddOnScreenDebugMessage(-1, DisplayTime, Color, *Message);