본문 바로가기

UE5(언리얼)

[언리얼/UE5] 디버거 헬퍼

반응형

로그  출력을 쉽게하는 함수를 만드는 과정입니다.

 

public에 헤더 파일 1개를 만들어준다.

근데 경로를 보면 Intermediate(빌드 과정에서 임시로 생성되는 폴더)이다. 그렇기 때문에 경로를 재지정해줘야된다.  

 

{본인 경로}\Source\Warrior\Public 에 저장하면 된다. 

#pragma once

namespace Debug
{
	static void Print(const FString& Msg, const FColor& Color = FColor::MakeRandomColor(), int32 InKey = -1)
	{
		if (GEngine)
		{
			GEngine->AddOnScreenDebugMessage(InKey, 7.0f, Color, Msg);

			UE_LOG(LogTemp, Warning, TEXT("%s"), *Msg);
		}
	}
}

 

이렇게 코드를 추가해주면

 

나중에 GEngin어쩌구저쩌구, UE_LOG저쩌구어쩌구 길게 안적고  Print로 끝낼 수 있다!

// Fill out your copyright notice in the Description page of Project Settings.


#include "Characters/WarriorHeroCharacter.h" 
#include "WarriorDebugHelper.h"

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

	Debug::Print("Hello UE5");
}

 

 

이렇게만 해주면 조금은 편하게 디버깅을 할 수 있을거다

 

반응형