Unreal C++ about how to print logs

Unreal C++ about how to print logs

First open the log window to get to know it!

 This is the log window!

Information can be filtered! 

 

It is also possible to just show some kind of log!

 

Know the interface! Let's start writing code! 

Old rules, give an entry function first!

#include "GameFramework/GameModeBase.h"
#include "Cpp_DemoGameModeBase.generated.h"

/**
 * 
 */
UCLASS()
class CPP_DEMO_API ACpp_DemoGameModeBase : public AGameModeBase
{
	GENERATED_BODY()

public :
	virtual void BeginPlay();
	
};

Cpp_DemoGameModeBase.cpp

#include "Cpp_DemoGameModeBase.h"
//在 MyGameModeBase.cpp 文件

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

	//GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Red, TEXT("你好世界!"));
	UE_LOG(LogTemp,Log,TEXT("你好世界!"));

}

Press f7 to compile! Then mount the game mode!

Compare, what is the reference! 

Guess you like

Origin blog.csdn.net/m0_46449592/article/details/128560141