Logo Ue Module And Build System

Ue Module And Build System

Cộng đồng
kevinpbuckley
ue-module-and-build-system

Structure Unreal C++ into modules and configure the build with *.Build.cs (ModuleRules) and *.Target.cs (TargetRules). Use when creating a new module, splitting code out of an existing module, adding a dependency, fixing "unresolved external symbol" / "cannot open include file" / "module not found" link errors, choosing public vs private dependencies, wiring IMPLEMENT_MODULE / IMPLEMENT_PRIMARY_GAME_MODULE / IModuleInterface, setting the module loading phase or host type, or understanding how UnrealBuildTool (UBT) discovers and compiles modules. Related to plugins: see ue-plugins-and-modules for packaging modules inside .uplugin files.

Tổng quan

Nhà phát hànhkevinpbuckley
Kho mãunreal-engine-skills
Tên kỹ năngue-module-and-build-system
Sao
89
Bản fork
9
Tệp đi kèm
3
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được kevinpbuckley công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Ue Module And Build System trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-module-and-build-system
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kevinpbuckley/unreal-engine-skills.git /tmp/unreal-engine-skills
mkdir -p .claude/skills
cp -r /tmp/unreal-engine-skills/skills/core/ue-module-and-build-system .claude/skills/ue-module-and-build-system
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Ue Module And Build System trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Ue Module And Build System ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Ue Module And Build System với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Modules & the build system

Every Unreal C++ feature lives in a module: a directory that compiles into its own DLL (modular builds) or static lib (monolithic builds). UnrealBuildTool (UBT) reads C#-style *.Build.cs files (one per module) and *.Target.cs files (one per build target) to decide what to compile and link. Most "won't compile / won't link" problems are really "wrong module dependency" problems.

Note: UE modules are independent of C++20 language modules.

When to use this skill

  • Adding a new module to a project or plugin, or splitting a growing module into smaller units.
  • Link/include errors: unresolved external (*_API symbol), "cannot open include file", "module X not found at startup".
  • Adding a dependency (e.g. you used UEnhancedInputComponent and need EnhancedInput).
  • Choosing PublicDependencyModuleNames vs PrivateDependencyModuleNames, or the loading phase and host type.
  • Understanding how UBT discovers modules and when to regenerate project files.

Mental model

  • A module = a folder under Source/<Module>/ with <Module>.Build.cs plus Public/ (headers other modules may include) and Private/ (implementation + internal headers).
  • The <MODULE>_API macro (e.g. MYGAME_API) expands to __declspec(dllexport/dllimport) in modular builds and to nothing in monolithic builds. Missing it on a class another module uses → unresolved external symbol.
  • To use another module's API you must (1) #include its public header and (2) list that module in your Build.cs dependencies. Both are required.
  • Targets (*.Target.cs) describe an executable: which modules it boots with and whether the build links them as a monolith or as separate DLLs.
  • UBT ignores the IDE solution when building — it reads only Build.cs/Target.cs files. Regenerate project files any time you add, move, or rename source files.

Module layout

Source/MyGame/
├── MyGame.Build.cs
├── Public/                # headers exposed to other modules
│   └── MyActor.h
└── Private/               # .cpp files + internal-only headers
    ├── MyActor.cpp
    └── MyGameModule.cpp   # IMPLEMENT_PRIMARY_GAME_MODULE lives here

#include paths resolve from the Public/Private root, not the disk path: a header at Public/Weapons/Gun.h is included as #include "Weapons/Gun.h". Files outside these canonical folders are treated as private automatically.

*.Build.cs — ModuleRules

Each module has exactly one <Name>.Build.cs in its root. UBT compiles it at build time.

csharp
using UnrealBuildTool;

public class MyGame : ModuleRules
{
    public MyGame(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;  // required for IWYU compliance

        // Types from these modules appear in THIS module's PUBLIC headers → Public
        PublicDependencyModuleNames.AddRange(new string[]
        {
            "Core", "CoreUObject", "Engine", "InputCore"
        });

        // Types used only in .cpp or private headers → Private (faster builds, leaner API)
        PrivateDependencyModuleNames.AddRange(new string[]
        {
            "EnhancedInput", "UMG", "Slate", "SlateCore"
        });

        // Editor-only dependencies — gate to avoid packaging bloat
        if (Target.bBuildEditor)
        {
            PrivateDependencyModuleNames.Add("UnrealEd");
        }
    }
}

Key rules:

  • If a dependency's types appear in your public headers, it must be a public dependency. If only in .cpp/private headers, prefer private.
  • The module name is the folder name containing the Build.cs (or the engine module's name).
  • Find which engine module owns a class by locating its header; see ue-navigating-engine-source.
  • PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs enables IWYU-safe precompiled headers. Each .cpp must include its matching .h first, and no monolithic headers (Engine.h).

See references/build-cs-reference.md for the full property list, advanced options, and third-party library integration.

*.Target.cs — TargetRules

A project normally has two: <Project>.Target.cs (Game) and <Project>Editor.Target.cs (Editor).

csharp
using UnrealBuildTool;

public class MyGameTarget : TargetRules
{
    public MyGameTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Game;                          // Game / Editor / Server / Client / Program
        DefaultBuildSettings = BuildSettingsVersion.V7; // use engine defaults from 5.x
        IncludeOrderVersion  = EngineIncludeOrderVersion.Latest;
        ExtraModuleNames.Add("MyGame");                  // primary game module(s)
    }
}

TargetType values: Game (cooked monolithic), Editor (modular with editor DLLs), Server, Client, Program. Editor targets link modularly; Game/Server/Client link monolithically on most platforms.

See references/target-cs-reference.md for all TargetRules fields, link types, and build settings.

Registering the module in C++

Every module needs exactly one registration macro in a single .cpp:

cpp
#include "Modules/ModuleManager.h"

// For the primary game module (name matches .uproject):
IMPLEMENT_PRIMARY_GAME_MODULE(FDefaultGameModuleImpl, MyGame, "MyGame");

// For secondary modules or plugin modules:
// IMPLEMENT_MODULE(FDefaultModuleImpl, MySecondaryModule);
  • FDefaultModuleImpl — empty IModuleInterface; does nothing at startup/shutdown. (ModuleManager.h:884)
  • FDefaultGameModuleImpl : FDefaultModuleImpl — overrides IsGameModule() to return true. (ModuleManager.h:892)
  • For startup/shutdown hooks, subclass IModuleInterface and override StartupModule() / ShutdownModule(). Use StartupModule to load dependent modules with FModuleManager::Get().LoadModuleChecked(TEXT("MyDep")).
cpp
// MyEditorModule.cpp
#include "Modules/ModuleManager.h"
#include "MyEditorModule.h"

IMPLEMENT_MODULE(FMyEditorModule, MyEditorModule)

void FMyEditorModule::StartupModule()
{
    // register editor extensions, detail customizations, etc.
}

void FMyEditorModule::ShutdownModule()
{
    // unregister everything registered in StartupModule
}

See references/module-cpp-and-phases.md for the full IModuleInterface API, loading-phase details, and FModuleManager query methods.

Declaring the module in .uproject / .uplugin

json
"Modules": [
  {
    "Name": "MyGame",
    "Type": "Runtime",
    "LoadingPhase": "Default"
  },
  {
    "Name": "MyGameEditor",
    "Type": "Editor",
    "LoadingPhase": "Default"
  }
]

Type (ModuleHostType enum, ModuleDescriptor.cs:16):

TypeLoaded in
Runtimeany target using the UE runtime
RuntimeNoCommandletruntime targets, except commandlets
Editoreditor only — stripped from packaged games
EditorNoCommandleteditor only, not in commandlets
Developer / DeveloperToolbuilds with developer tools enabled
ServerOnly / ClientOnlyserver-only or client-only targets
UncookedOnlyuncooked builds only
Programstandalone programs

LoadingPhase (ModuleLoadingPhase enum, ModuleDescriptor.cs:102):

PhaseWhen
EarliestPossibleas soon as GConfig is ready
PostConfigInitafter config, before most engine systems
PreLoadingScreenbefore the loading screen fires
PreDefaultjust before Default
Defaultafter game modules are loaded (standard)
PostDefaultjust after Default
PostEngineInitafter engine is fully initialized
Nonenot loaded automatically

Most gameplay code uses Default. Plugin modules that provide factories or types needed by other modules often use PreDefault. If the editor keeps throwing "class not found" for your plugin, try PreDefault.

Adding a new module (checklist)

  1. Create Source/<New>/ with Public/ and Private/ subdirectories.
  2. Add <New>.Build.cs inheriting ModuleRules, list dependencies.
  3. Add Private/<New>Module.cpp with IMPLEMENT_MODULE(FDefaultModuleImpl, <New>).
  4. Add the module entry to .uproject/.uplugin Modules array.
  5. Add <New> to other modules' dependency lists where they consume it.
  6. Regenerate project files (right-click .uproject → Generate Visual Studio Project Files).
  7. Build.

<MODULE>_API export macros

MYGAME_API expands to __declspec(dllexport) when compiling the module and __declspec(dllimport) when another module includes it, and to nothing in monolithic builds. Apply it to the class keyword or individual functions:

cpp
// Export the whole class — all virtual and non-inline members cross the DLL boundary
class MYGAME_API UMyComponent : public UActorComponent { ... };

// Export only a free function
MYGAME_API void MyGlobalHelper();

Rules:

  • Apply MYGAME_API to any class, function, or data symbol another module accesses.
  • Inner classes and nested types need their own _API if used externally.
  • Do not apply to template class bodies — templates are header-only.
  • Forgetting _API on a class used by another module → unresolved external symbol at link.

Gotchas

  • Missing <MODULE>_API on a class used cross-module → unresolved external symbol.
  • Forgot to add the module to Build.cs → "cannot open include file" even though the header exists on disk; or unresolved externals for symbols in that header.
  • Circular module dependencies fail to link — extract shared types to a lower-level module.
  • Editor module referenced by a runtime module breaks packaging — keep editor code in an Editor-type module and guard with #if WITH_EDITOR.
  • Changing Build.cs or moving source files requires regenerating project files before building, not just a Live Coding reload.
  • FModuleManager::LoadModuleChecked in StartupModule ensures the dependency is loaded before your module uses it. Relying on load order without this can produce intermittent crashes when the phase is shared with other modules.
  • Monolithic vs modular builds: in a shipped game (monolithic) _API macros are empty and DLL boundary rules don't apply; but code written without _API will fail in Editor builds (modular). Always use the macro correctly.

Version notes

  • BuildSettingsVersion.V7 is the current recommended value in UE 5.8 (TargetRules.cs:177). New projects generated by the engine use BuildSettingsVersion.V7 (= Latest).
  • EngineIncludeOrderVersion.Latest (= Unreal5_8) in UE 5.8 (TargetRules.cs:242).
  • The bRequiresImplementModule property (default true) in ModuleRules.cs enforces the IMPLEMENT_MODULE macro presence at link time.

Cross-references

  • ue-plugins-and-modules — packaging modules inside a .uplugin; plugin vs project module.
  • ue-project-structure — .uproject layout, Source/ and Config/ conventions.
  • ue-navigating-engine-source — finding which module owns a class or header.
  • ue-cpp-fundamentals — UCLASS/USTRUCT/UENUM, the reflection system.

References & source material

Engine source (UE 5.8, under E:\Program Files\Epic Games\UE_5.8\Engine\Source\):

C++ module system (Runtime/Core/Public/Modules/):

  • ModuleInterface.h — IModuleInterface: StartupModule():49, ShutdownModule():79, SupportsDynamicReloading():88, IsGameModule():108.
  • ModuleManager.h — FModuleManager:163, FDefaultModuleImpl:884, FDefaultGameModuleImpl:892, IMPLEMENT_MODULE macro:946, IMPLEMENT_PRIMARY_GAME_MODULE macro:1100/1130.
  • Boilerplate/ModuleBoilerplate.h — PER_MODULE_BOILERPLATE:115 (new/delete overrides, memory wrapper definitions placed in every module).

UBT C# configuration (Programs/UnrealBuildTool/Configuration/Rules/):

  • ModuleRules.cs — ModuleRules class:105, PCHUsageMode enum:195, PublicDependencyModuleNames:1259, PrivateDependencyModuleNames:1270.
  • TargetRules.cs — TargetType enum:21, TargetLinkType enum:53, DefaultBuildSettings:740, ExtraModuleNames:2819.

UBT C# descriptors (Programs/UnrealBuildTool/Configuration/Descriptors/):

  • ModuleDescriptor.cs — ModuleHostType enum:16, ModuleLoadingPhase enum:102, ModuleDescriptor class:159.

Official docs (UE 5.8, all fetched and verified):

Deep-dive references in this skill:

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Ue Module And Build System làm được gì?

Structure Unreal C++ into modules and configure the build with *.Build.cs (ModuleRules) and *.Target.cs (TargetRules). Use when creating a new module, splitting code out of an existing module, adding a dependency, fixing "unresolved external symbol" / "cannot open include file" / "module not found" link errors, choosing public vs private dependencies, wiring IMPLEMENT_MODULE / IMPLEMENT_PRIMARY_GAME_MODULE / IModuleInterface, setting the module loading phase or host type, or understanding how UnrealBuildTool (UBT) discovers and compiles modules. Related to plugins: see ue-plugins-and-module...

Vì sao nên dùng Ue Module And Build System trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Ue Module And Build System là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Ue Module And Build System trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-module-and-build-system. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Ue Module And Build System?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Ue Module And Build System với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Ue Module And Build System với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Ue Module And Build System có miễn phí không?

Kỹ năng này được kevinpbuckley phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇