[Unreal4] C++ (1) - 클래스 생성, 로그, 빌드

Kim Yuhyeon·2023년 5월 21일
0

게임개발

목록 보기
116/135

클래스 생성

콘텐츠 브라우저 > 우클릭 > 새로운 C++클래스

MyActor.h

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"

UCLASS()
class LOSTARK_API AMyActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AMyActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;

};

MyActor.cpp

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


#include "MyActor.h"

// Sets default values
AMyActor::AMyActor()
{
 	//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;
	UE_LOG(LogTemp, Log, TEXT("Constructor"));

}

// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
	Super::BeginPlay();
	UE_LOG(LogTemp, Log, TEXT("BeginPlay"));

}

 // Called every frame
void AMyActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
	UE_LOG(LogTemp, Log, TEXT("Tick"));

}

로그

UE_LOG(LogTemp, Log, TEXT("Constructor"));

빌드

혹은 비주얼 스튜디오에서 빌드

참고

https://www.youtube.com/watch?v=NfZr4VjU-0s&list=PLYQHfkihy4AzWWeI4bfdng2FPb_t7V87

0개의 댓글