UE4的UE_LOG

一:快速使用

UE_LOG(LogTemp, Warning, TEXT("Hello World"));

二:Log格式

2.1 message

//"This is a message to yourself during runtime!"
UE_LOG(LogTemp,Warning,TEXT("This is a message to yourself during runtime!"));

2.2 FString

//"MyCharacter's Name is %s"
UE_LOG(LogTemp,Warning,TEXT("MyCharacter's Name is %s"), *MyCharacter->GetName() );

2.3 Int

//"MyCharacter's Levelis %d"
UE_LOG(LogTemp,Warning,TEXT("MyCharacter's Health is %d"), MyCharacter->Level);

2.4 Float

//"MyCharacter's Health is %f"
UE_LOG(LogTemp,Warning,TEXT("MyCharacter's Health is %f"), MyCharacter->Health );

2.5 FVector

//"MyCharacter's Location is %s"
UE_LOG(LogTemp,Warning,TEXT("MyCharacter's Location is %s"), 
    *MyCharacter->GetActorLocation().ToString());

2.6 FName

//"MyCharacter's FName is %s"
UE_LOG(LogTemp,Warning,TEXT("MyCharacter's FName is %s"), 
    *MyCharacter->GetFName().ToString());

2.7 FString,Int,Float

//"%s has health %d, which is %f percent of total health"
UE_LOG(LogTemp,Warning,TEXT("%s has health %d, which is %f percent of total health"),
    *MyCharacter->GetName(), MyCharacter->Health, MyCharacter->HealthPercent);

你可能感兴趣的:(虚幻4,UE4)