Unreal C++记录 _ 打印

#include "AConsoleLog.h"
#define print(text) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 1.5, FColor::Green,text)
#define printFString(text, fstring) if (GEngine) GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Magenta, FString::Printf(TEXT(text), fstring))
// Sets default values
AAConsoleLog::AAConsoleLog()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

}

// Called when the game starts or when spawned
void AAConsoleLog::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Warning, TEXT("I just started running"));

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Screen Message"));

	FVector MyVector = FVector(200, 100, 900);

	GEngine->AddOnScreenDebugMessage(-1,6.f,FColor::Orange,FString::Printf(TEXT("My Location is : %s"),*GetActorLocation().ToString()));

	print("Hello Unreal");
	printFString("My Variable Vector is : %s", *MyVector.ToString());
}

 


版权声明:本文为weixin_38527697原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。