Unreal Engine 4.x Scripting with C++ Cookbook
上QQ阅读APP看书,第一时间看更新

How to do it...

  1. In your code, enter a line of code using the following form:
UE_LOG(LogTemp, Warning, TEXT("Some warning message") );

For instance, if you wanted to add this to the script in the previous recipe, it may look like this:

#include "Chapter_01GameModeBase.h"

void AChapter_01GameModeBase::BeginPlay()
{
Super::BeginPlay();

// Basic UE_LOG message
UE_LOG(LogTemp, Warning, TEXT("Some warning message") );
}
  1. Turn on the Output Log inside the UE4 editor by going to Window | Developer Tools | Output Log to see your log messages printed in that window as your program is running:
  1. If you play your game by clicking on the Play button from the top toolbar, you should notice our text being displayed in yellow on the log:
To make your output easier to see, you can clear the   Output Log  at any time by right-clicking on it within the window and selecting   Clear Log.