Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 |
Tags
- 도넛튜토리얼
- 백준
- 블렌더도넛
- 카드뉴스
- 프로그래머스
- 파이썬
- cs기초
- Python
- level1
- Photoshop
- leetcode
- CS
- 블렌더튜토리얼
- 자바스크립트
- 포토샵
- 단계별로 풀어보기
- 3d스터디
- 단계별문제풀이
- 비트연산
- 블렌더
- AI
- 3D그래픽
- 알고리즘
- blender
- blender4.0
- c언어
- boj
- csharp
- 코딩테스트
- 3d모델링
Archives
- Today
- Total
슬로우도파민
[Unreal] Actor 클래스 본문
Actor
Level 에 올릴 수 있는 클래스
Header 파일
클래스를 선언하고, 클래스에 속하는 변수와 함수의 원형을 선언하는 용도의 파일.
Actor 클래스 내 함수들
1) 생성자
클래스가 생성될 때 호출.
클래스 이름이랑 같음.
변수 set 해줌.
2) BeginPlay()
Actor 가 배치된 월드에서 게임이 시작되거나, Actor가 월드에 Spawn 되었을 때 한 번 호출됨.
게임 플레이 로직을 초기화 시키는데 사용됨.
3) Tick()
매 프레임마다 한 번씩 호출.
DeltaTime 매개변수로 Tick 함수가 얼마 시간을 두고 다시 호출되었는지 측정이 가능하다.
Actor가 살아있는 동안 계속 호출됨.
게임 로직을 주로 여기서 처리.
게임 퍼포먼스 향상을 위해 필요없다면 제거해주는 것이 좋음.
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 FIRSTCPP_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;
}
// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AMyActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
PrimaryActorTick.bCanEverTick = true;
Tick함수를 매프레임 호출할 것인지에 대한 설정.
로그찍는 방법
UE_LOG(LogTemp, Log, TEXT("Tick"));
(출처 : 베르의 게임개발 유튜브, https://youtu.be/DkJqLIpSvik?si=tjjMtwpYys_clVN2)
'개발기록 > 개발스터디' 카테고리의 다른 글
| [Unreal] 변수 (1) | 2024.01.31 |
|---|---|
| [안드로이드-코틀린] Adding a RecyclerView to your app (0) | 2021.07.16 |
| [AndroidStudio-Kotlin] View Binding 뷰 바인딩 (0) | 2021.07.13 |
| 안드로이드 스튜디오 TIPS (0) | 2021.07.12 |
| 안드로이드 스튜디오 개발환경설정 (0) | 2021.07.05 |
