- Unreal Engine 4.x Scripting with C++ Cookbook
- John P. Doran William Sherif Stephen Whittle
- 150字
- 2025-02-28 12:28:30
How to do it...
- 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") );
}
- 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:

- 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.