1-4강 언리얼 오브젝트 기초

Ryan Ham·2024년 7월 3일
0

이득우 Unreal

목록 보기
11/23

모던 객체 지향 설계 원칙

  • 디자인 패턴을 필두로 안정적인 설계 방법이 연구됨
  • 현재 시점에서 모던(Modern)하다는 뜻은 아님.
  • 유지 보수와 유연함, 확장성 향상을 위한 객체 지향 프로그래밍 원칙(SOLID)
    • Single responsibility principle : 하나의 클래스는 하나의 책임만 가져야 한다.
    • Open/Closed principle : 클래스 설계를 변경하지 않고 동작을 확장할 수 있어야 한다.
    • Liskov substitution principle : 자식 클래스는 부모 클래스를 대체 사용할 수 있어야 한다.
    • Interface segregation principle : 작고 명확한 interface들로 분리해 관리해야 한다.
    • Dependency inversion principle : 구현을 배제시킨 상위 정책을 바라보며 설계해야 한다.

후발 언어등이 보완한 새로운 기능

  • Interface : 객체 설계의 틀을 제공하는 추상 클래스
  • Reflection : Runtime에서 객체의 구조를 파악하고 객체에 meta-data를 부여
  • Delegate : 프로그램에서 발생한 event를 다수의 객체에 효과적으로 전달하는데 활용

C++ -> 언리얼 C++

언리얼 오브젝트란?

  • 구분을 위해 일반 C++ 오브젝트는 접두사 F, 언리얼 오브젝트는 접두사 U를 사용.
  • UCLASS라는 macro를 사용하면 객체를 UObject로 만들 수 있다.

UHT(Unreal Header Tool)

UHT는 언리얼 오브젝트에서 다양한 기능이 지원되도록 도와주는 역할을 한다. 개발자들은 단순히 macro만 지정해 주면 된다.

UHT는 컴파일 단계 이전!

언리얼 엔진의 코드는 바로 컴파일 되지 않는다.

1 단계 : UHT(Unreal Header Tool)에 의해서 소스 코드를 자동으로 생성.
2 단계 : 자동으로 생성된 코드를 포함해서 마지막 최종 Build를 진행.

generated.h 파일은 뭘까?

In Unreal Engine, a generated.h file is an auto-generated header file that is created by the Unreal Header Tool (UHT) as part of the build process. This file is associated with a corresponding .h file that contains Unreal Engine-specific macros, such as UCLASS, USTRUCT, UENUM, and UPROPERTY. These macros are used to mark up the code for Unreal's reflection system, which provides runtime type information and other metadata that the engine uses for various purposes, such as serialization, network replication, and garbage collection.

Here's a more detailed explanation of its role and usage:

Reflection System: The Unreal Header Tool processes the macros in your C++ header files and generates the necessary code for Unreal's reflection system. This system allows the engine to understand and manipulate your classes and properties at runtime.

Metadata: The generated.h file contains metadata and boilerplate code that helps the engine interact with your classes and properties. This includes information about class hierarchies, property offsets, and various other details needed by the engine.

Automatic Inclusion: When you include a header file that has Unreal Engine macros, you need to include the corresponding generated.h file at the end of your header file.

generated.h 파일이 존재하는 깊숙한 곳

프로젝트 폴더 -> Intermediate -> Build -> Win64 -> UnrealEditor -> Inc -> UnrealObject -> UHT


GENERATED_BODY()는 뭘까?

GENERATED_BODY() is a macro that automates the generation of essential code for Unreal Engine's reflection, serialization, and other engine-specific functionalities.

The generated.h file contains the code generated by the Unreal Header Tool (UHT) based on the Unreal-specific macros in your class.

The relationship between the two is that GENERATED_BODY() pulls in and integrates the code from the generated.h file into your class, ensuring it has all the necessary boilerplate to function correctly within the Unreal Engine ecosystem.


UBT(Unreal Build Tool)와 UHT(Unreal Header Tool)

Unreal Build Tool (UBT) is Unreal Engine's custom build system designed to manage the compilation and linking of code and assets efficiently. It handles dependency management, cross-platform builds, and integration with various IDEs, using configuration files like .Build.cs and .Target.cs to set up different build targets such as games, editor tools, and servers. UBT automates the build process, ensuring faster and more reliable builds, and supports continuous integration systems for automated testing and deployment.

UBT and UHT work together to streamline the build process in Unreal Engine. UBT orchestrates the entire build sequence, invoking UHT to process header files with Unreal-specific macros and generate the necessary .generated.h files. This ensures that all reflection data and metadata required by the engine are up-to-date before UBT proceeds with the actual compilation and linking of the project. By coordinating their functions, UBT ensures efficient builds while UHT handles the generation of essential boilerplate code for the engine's reflection and serialization systems.

profile
🏦KAIST EE | 🏦SNU AI(빅데이터 핀테크 전문가 과정) | 📙CryptoHipsters 저자

0개의 댓글