claude-code-arcane 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +131 -41
- package/agents/game/ue-blueprint-specialist.md +125 -0
- package/agents/game/ue-gas-specialist.md +133 -0
- package/agents/game/ue-umg-specialist.md +131 -0
- package/dist/cli.js +642 -478
- package/docs/SKILLS-CATALOG.md +42 -3
- package/docs/USER-GUIDE.md +28 -54
- package/hooks/detect-unreal.sh +90 -0
- package/package.json +2 -1
- package/profiles/agile.yaml +1 -1
- package/profiles/ai.yaml +1 -1
- package/profiles/android-native.yaml +1 -1
- package/profiles/audio.yaml +1 -1
- package/profiles/backend-dotnet.yaml +1 -1
- package/profiles/backend-go.yaml +1 -1
- package/profiles/backend-nestjs.yaml +1 -1
- package/profiles/backend-nextjs.yaml +1 -1
- package/profiles/backend-ts.yaml +1 -1
- package/profiles/business.yaml +1 -1
- package/profiles/clevel.yaml +1 -1
- package/profiles/clickup.yaml +1 -1
- package/profiles/core.yaml +1 -1
- package/profiles/database.yaml +1 -1
- package/profiles/design.yaml +1 -1
- package/profiles/docs.yaml +1 -1
- package/profiles/ecommerce.yaml +1 -1
- package/profiles/finance.yaml +1 -1
- package/profiles/flutter.yaml +1 -1
- package/profiles/freelance.yaml +1 -1
- package/profiles/frontend.yaml +1 -1
- package/profiles/infra.yaml +1 -1
- package/profiles/integrations.yaml +1 -1
- package/profiles/ios-native.yaml +1 -1
- package/profiles/jira.yaml +1 -1
- package/profiles/job-hunt.yaml +1 -1
- package/profiles/marketing.yaml +1 -1
- package/profiles/mobile.yaml +1 -1
- package/profiles/regulatory.yaml +1 -1
- package/profiles/second-brain.yaml +1 -1
- package/profiles/security.yaml +1 -1
- package/profiles/self-improving.yaml +1 -1
- package/profiles/statusline.yaml +1 -1
- package/profiles/testing.yaml +1 -1
- package/profiles/unity-design.yaml +1 -1
- package/profiles/unity-dev.yaml +1 -1
- package/profiles/unreal-dev.yaml +97 -0
- package/profiles/visual-novel.yaml +1 -1
- package/rules/gamedev/unreal-code.md +125 -0
- package/skills/arcane-list/SKILL.md +12 -7
- package/skills/install-mcp/SKILL.md +135 -46
- package/skills/install-mcp/references/unreal-operations.md +55 -0
- package/skills/ue-actor-component-architecture/SKILL.md +509 -0
- package/skills/ue-actor-component-architecture/references/actor-lifecycle.md +301 -0
- package/skills/ue-actor-component-architecture/references/component-types.md +592 -0
- package/skills/ue-ai-navigation/SKILL.md +526 -0
- package/skills/ue-ai-navigation/references/behavior-tree-patterns.md +392 -0
- package/skills/ue-ai-navigation/references/behavior-tree-workflow.md +107 -0
- package/skills/ue-ai-navigation/references/custom-bttask.md +104 -0
- package/skills/ue-ai-navigation/references/eqs-reference.md +423 -0
- package/skills/ue-animation-system/SKILL.md +521 -0
- package/skills/ue-animation-system/references/anim-notify-reference.md +486 -0
- package/skills/ue-animation-system/references/locomotion-setup.md +550 -0
- package/skills/ue-async-threading/SKILL.md +433 -0
- package/skills/ue-async-threading/references/thread-safety-guide.md +213 -0
- package/skills/ue-async-threading/references/threading-patterns.md +345 -0
- package/skills/ue-audio-system/SKILL.md +527 -0
- package/skills/ue-audio-system/references/audio-setup-patterns.md +700 -0
- package/skills/ue-blueprints/SKILL.md +134 -0
- package/skills/ue-blueprints/references/communication.md +82 -0
- package/skills/ue-character-movement/SKILL.md +475 -0
- package/skills/ue-character-movement/references/cmc-extension-patterns.md +335 -0
- package/skills/ue-character-movement/references/movement-pipeline.md +189 -0
- package/skills/ue-cpp-foundations/SKILL.md +533 -0
- package/skills/ue-cpp-foundations/references/components-and-gc.md +107 -0
- package/skills/ue-cpp-foundations/references/container-patterns.md +544 -0
- package/skills/ue-cpp-foundations/references/delegate-patterns.md +497 -0
- package/skills/ue-cpp-foundations/references/gameplay-classes-cpp.md +136 -0
- package/skills/ue-cpp-foundations/references/property-specifiers.md +306 -0
- package/skills/ue-data-assets-tables/SKILL.md +527 -0
- package/skills/ue-data-assets-tables/references/asset-loading-patterns.md +306 -0
- package/skills/ue-data-assets-tables/references/data-driven-design.md +378 -0
- package/skills/ue-editor-tools/SKILL.md +523 -0
- package/skills/ue-editor-tools/references/detail-customization-patterns.md +395 -0
- package/skills/ue-editor-tools/references/editor-module-setup.md +480 -0
- package/skills/ue-game-features/SKILL.md +477 -0
- package/skills/ue-game-features/references/experience-system.md +222 -0
- package/skills/ue-game-features/references/game-feature-patterns.md +308 -0
- package/skills/ue-gameplay-abilities/SKILL.md +518 -0
- package/skills/ue-gameplay-abilities/references/ability-task-reference.md +391 -0
- package/skills/ue-gameplay-abilities/references/gameplay-effect-reference.md +397 -0
- package/skills/ue-gameplay-abilities/references/gas-setup-patterns.md +369 -0
- package/skills/ue-gameplay-framework/SKILL.md +466 -0
- package/skills/ue-gameplay-framework/references/framework-class-map.md +243 -0
- package/skills/ue-input-system/SKILL.md +394 -0
- package/skills/ue-input-system/references/cpp-setup.md +131 -0
- package/skills/ue-input-system/references/enhanced-input-workflow.md +117 -0
- package/skills/ue-input-system/references/input-action-reference.md +731 -0
- package/skills/ue-mass-entity/SKILL.md +476 -0
- package/skills/ue-mass-entity/references/mass-entity-patterns.md +319 -0
- package/skills/ue-mass-entity/references/mass-fragment-reference.md +119 -0
- package/skills/ue-materials-rendering/SKILL.md +526 -0
- package/skills/ue-materials-rendering/references/material-parameter-reference.md +216 -0
- package/skills/ue-materials-rendering/references/post-process-settings.md +383 -0
- package/skills/ue-module-build-system/SKILL.md +487 -0
- package/skills/ue-module-build-system/references/build-cs-reference.md +418 -0
- package/skills/ue-module-build-system/references/common-build-errors.md +381 -0
- package/skills/ue-naming-conventions/SKILL.md +142 -0
- package/skills/ue-naming-conventions/references/asset-name-modifiers.md +233 -0
- package/skills/ue-naming-conventions/references/content-structure.md +83 -0
- package/skills/ue-networking-replication/SKILL.md +452 -0
- package/skills/ue-networking-replication/references/replication-patterns.md +526 -0
- package/skills/ue-networking-replication/references/rpc-decision-guide.md +393 -0
- package/skills/ue-niagara-effects/SKILL.md +531 -0
- package/skills/ue-niagara-effects/references/niagara-data-interfaces.md +491 -0
- package/skills/ue-niagara-effects/references/niagara-parameter-types.md +153 -0
- package/skills/ue-niagara-effects/references/niagara-workflow.md +115 -0
- package/skills/ue-packaging/SKILL.md +116 -0
- package/skills/ue-physics-collision/SKILL.md +423 -0
- package/skills/ue-physics-collision/references/collision-channel-setup.md +218 -0
- package/skills/ue-physics-collision/references/trace-patterns.md +499 -0
- package/skills/ue-procedural-generation/SKILL.md +505 -0
- package/skills/ue-procedural-generation/references/pcg-node-reference.md +381 -0
- package/skills/ue-procedural-generation/references/procedural-mesh-patterns.md +940 -0
- package/skills/ue-project-context/SKILL.md +305 -0
- package/skills/ue-sequencer-cinematics/SKILL.md +506 -0
- package/skills/ue-sequencer-cinematics/references/sequencer-patterns.md +629 -0
- package/skills/ue-serialization-savegames/SKILL.md +524 -0
- package/skills/ue-serialization-savegames/references/save-system-architecture.md +705 -0
- package/skills/ue-state-trees/SKILL.md +489 -0
- package/skills/ue-state-trees/references/state-tree-mass-integration.md +184 -0
- package/skills/ue-state-trees/references/state-tree-patterns.md +321 -0
- package/skills/ue-testing-debugging/SKILL.md +520 -0
- package/skills/ue-testing-debugging/references/automation-test-patterns.md +387 -0
- package/skills/ue-testing-debugging/references/profiling-commands.md +357 -0
- package/skills/ue-ui-umg-slate/SKILL.md +431 -0
- package/skills/ue-ui-umg-slate/references/common-ui-setup.md +484 -0
- package/skills/ue-ui-umg-slate/references/widget-types.md +487 -0
- package/skills/ue-world-level-streaming/SKILL.md +518 -0
- package/skills/ue-world-level-streaming/references/streaming-patterns.md +414 -0
- package/templates/gamedev/unreal-project-context.md +107 -0
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ue-module-build-system
|
|
3
|
+
description: "Build.cs, Target.cs, module creation, plugin setup, build configuration"
|
|
4
|
+
category: "gamedev"
|
|
5
|
+
argument-hint: "[module o plugin]"
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools: Read, Glob, Grep, Bash, Write, Edit
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# UE Module & Build System
|
|
11
|
+
|
|
12
|
+
You are an expert in Unreal Engine's module and build system. You understand Unreal Build Tool (UBT), ModuleRules, TargetRules, the .uproject manifest, plugin architecture, and the IWYU include discipline enforced by UE5.
|
|
13
|
+
|
|
14
|
+
Ask before writing: this skill edits `Build.cs`, `Target.cs` and plugin descriptor files. Propose the change and get approval before using Write or Edit.
|
|
15
|
+
|
|
16
|
+
## Before Starting
|
|
17
|
+
|
|
18
|
+
Read `docs/unreal/project-context.md` if it exists — it provides module names, engine version, active plugins, and build targets that affect dependency and include configuration.
|
|
19
|
+
|
|
20
|
+
Ask which situation applies:
|
|
21
|
+
1. Configuring dependencies in an existing Build.cs
|
|
22
|
+
2. Creating a new module from scratch
|
|
23
|
+
3. Creating a new plugin
|
|
24
|
+
4. Resolving a build error (linker, include, or IWYU)
|
|
25
|
+
5. Setting up Target.cs for a new build target
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Build.cs Anatomy
|
|
30
|
+
|
|
31
|
+
Every UE module has a `ModuleName.Build.cs` file next to its `Public/` and `Private/` directories.
|
|
32
|
+
|
|
33
|
+
```csharp
|
|
34
|
+
// Source/MyModule/MyModule.Build.cs
|
|
35
|
+
using UnrealBuildTool;
|
|
36
|
+
|
|
37
|
+
public class MyModule : ModuleRules
|
|
38
|
+
{
|
|
39
|
+
public MyModule(ReadOnlyTargetRules Target) : base(Target)
|
|
40
|
+
{
|
|
41
|
+
// PCH settings — use IWYU in UE5
|
|
42
|
+
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
43
|
+
// Enable strict IWYU (recommended for new modules in UE5)
|
|
44
|
+
bEnforceIWYU = true;
|
|
45
|
+
|
|
46
|
+
// Types accessible to modules that depend on MyModule
|
|
47
|
+
PublicDependencyModuleNames.AddRange(new string[]
|
|
48
|
+
{
|
|
49
|
+
"Core",
|
|
50
|
+
"CoreUObject",
|
|
51
|
+
"Engine",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Types used only internally (not re-exported in public headers)
|
|
55
|
+
PrivateDependencyModuleNames.AddRange(new string[]
|
|
56
|
+
{
|
|
57
|
+
"Slate",
|
|
58
|
+
"SlateCore",
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Load at runtime but don't link at compile time
|
|
62
|
+
DynamicallyLoadedModuleNames.Add("OnlineSubsystem");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Public vs Private Dependencies
|
|
68
|
+
|
|
69
|
+
| Field | When to use |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `PublicDependencyModuleNames` | A type from the dependency appears in your **public headers** |
|
|
72
|
+
| `PrivateDependencyModuleNames` | The dependency is consumed only in **Private/** .cpp files |
|
|
73
|
+
|
|
74
|
+
A common mistake: putting everything in `PublicDependencyModuleNames`. This bloats transitive include paths for every downstream module. Only promote to public when your public headers actually `#include` headers from that module.
|
|
75
|
+
|
|
76
|
+
### Include Paths
|
|
77
|
+
|
|
78
|
+
```csharp
|
|
79
|
+
// Expose extra paths to modules that depend on you
|
|
80
|
+
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "Public/Interfaces"));
|
|
81
|
+
|
|
82
|
+
// Expose extra paths only to this module's own source
|
|
83
|
+
PrivateIncludePaths.Add(Path.Combine(ModuleDirectory, "Private/Helpers"));
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
UBT automatically adds `Public/` and `Private/` — you rarely need to set these manually unless you have nested subdirectory headers you want to import without path prefixes.
|
|
87
|
+
|
|
88
|
+
### API Export Macro
|
|
89
|
+
|
|
90
|
+
UBT generates `MODULENAME_API` from the module's directory name, uppercased. Any class, function, or variable that must be visible across DLL boundaries needs this macro:
|
|
91
|
+
|
|
92
|
+
```cpp
|
|
93
|
+
// Public/MyClass.h
|
|
94
|
+
#pragma once
|
|
95
|
+
#include "CoreMinimal.h"
|
|
96
|
+
|
|
97
|
+
class MYMODULE_API FMyClass
|
|
98
|
+
{
|
|
99
|
+
public:
|
|
100
|
+
void DoSomething();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Standalone exported function
|
|
104
|
+
MYMODULE_API void MyFreeFunction();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Missing `MYMODULE_API` on a class that another module references causes "unresolved external symbol" linker errors.
|
|
108
|
+
|
|
109
|
+
### PCH and IWYU
|
|
110
|
+
|
|
111
|
+
```csharp
|
|
112
|
+
// UE5 recommended — each file includes exactly what it uses
|
|
113
|
+
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
114
|
+
bEnforceIWYU = true;
|
|
115
|
+
|
|
116
|
+
// Legacy — one monolithic PCH (avoid for new modules)
|
|
117
|
+
PCHUsage = PCHUsageMode.UseSharedPCHs;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
With IWYU, every `.cpp` file includes its own `.h` first, then only what it directly uses:
|
|
121
|
+
|
|
122
|
+
```cpp
|
|
123
|
+
// Private/MyClass.cpp
|
|
124
|
+
#include "MyClass.h" // own header first
|
|
125
|
+
#include "Engine/Actor.h" // only includes this file directly uses
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Compiler Flags
|
|
129
|
+
|
|
130
|
+
```csharp
|
|
131
|
+
// C++ exceptions — disable unless third-party code requires them
|
|
132
|
+
bEnableExceptions = false;
|
|
133
|
+
|
|
134
|
+
// Runtime type information — disable unless using dynamic_cast
|
|
135
|
+
bUseRTTI = false;
|
|
136
|
+
|
|
137
|
+
// Third-party static libraries shipped with the engine
|
|
138
|
+
AddEngineThirdPartyPrivateStaticDependencies(Target, "zlib", "OpenSSL");
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Target.cs
|
|
144
|
+
|
|
145
|
+
Located at `Source/ProjectName.Target.cs` (and `Source/ProjectNameEditor.Target.cs`).
|
|
146
|
+
|
|
147
|
+
```csharp
|
|
148
|
+
// Source/MyGame.Target.cs
|
|
149
|
+
using UnrealBuildTool;
|
|
150
|
+
using System.Collections.Generic;
|
|
151
|
+
|
|
152
|
+
public class MyGameTarget : TargetRules
|
|
153
|
+
{
|
|
154
|
+
public MyGameTarget(TargetInfo Target) : base(Target)
|
|
155
|
+
{
|
|
156
|
+
Type = TargetType.Game;
|
|
157
|
+
DefaultBuildSettings = BuildSettingsVersion.Latest;
|
|
158
|
+
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
|
|
159
|
+
|
|
160
|
+
// All game modules that UBT should compile
|
|
161
|
+
ExtraModuleNames.AddRange(new string[] { "MyGame", "MyGameUtilities" });
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Source/MyGameEditor.Target.cs
|
|
166
|
+
public class MyGameEditorTarget : TargetRules
|
|
167
|
+
{
|
|
168
|
+
public MyGameEditorTarget(TargetInfo Target) : base(Target)
|
|
169
|
+
{
|
|
170
|
+
Type = TargetType.Editor;
|
|
171
|
+
DefaultBuildSettings = BuildSettingsVersion.Latest;
|
|
172
|
+
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
|
|
173
|
+
ExtraModuleNames.AddRange(new string[] { "MyGame", "MyGameEditor" });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Target Types
|
|
179
|
+
|
|
180
|
+
| TargetType | Use for |
|
|
181
|
+
|---|---|
|
|
182
|
+
| `Game` | Standalone game executable |
|
|
183
|
+
| `Editor` | Editor build (includes editor-only modules) |
|
|
184
|
+
| `Client` | Networked client without server logic |
|
|
185
|
+
| `Server` | Dedicated server (no renderer) |
|
|
186
|
+
| `Program` | Standalone non-game tool |
|
|
187
|
+
|
|
188
|
+
**Build configurations**: `Debug` (full symbols, no optimization), `DebugGame` (engine optimized, game debug), `Development` (default; balanced), `Test` (like shipping but with console/stats), `Shipping` (final release, strips all debug).
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## .uproject File
|
|
193
|
+
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"FileVersion": 3,
|
|
197
|
+
"EngineAssociation": "5.4",
|
|
198
|
+
"Category": "",
|
|
199
|
+
"Description": "",
|
|
200
|
+
"Modules": [
|
|
201
|
+
{
|
|
202
|
+
"Name": "MyGame",
|
|
203
|
+
"Type": "Runtime",
|
|
204
|
+
"LoadingPhase": "Default"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"Name": "MyGameEditor",
|
|
208
|
+
"Type": "Editor",
|
|
209
|
+
"LoadingPhase": "Default"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"Plugins": [
|
|
213
|
+
{
|
|
214
|
+
"Name": "ModelingToolsEditorMode",
|
|
215
|
+
"Enabled": true
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"Name": "MyPlugin",
|
|
219
|
+
"Enabled": true
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Module Types
|
|
226
|
+
|
|
227
|
+
| Type | When to use |
|
|
228
|
+
|---|---|
|
|
229
|
+
| `Runtime` | Core game logic, ships with game |
|
|
230
|
+
| `RuntimeNoCommandlet` | Runtime, excluded from commandlet processes |
|
|
231
|
+
| `Editor` | Editor-only — stripped from shipping builds |
|
|
232
|
+
| `EditorNoCommandlet` | Editor, excluded from commandlets |
|
|
233
|
+
| `Developer` | Tools usable in Editor and Development builds |
|
|
234
|
+
| `DeveloperTool` | Developer module, shows in editor UI |
|
|
235
|
+
| `CookedOnly` | Included only in cooked (packaged) builds |
|
|
236
|
+
| `UncookedOnly` | Included only in uncooked (development) builds |
|
|
237
|
+
| `RuntimeAndProgram` | Runtime module that also compiles into standalone Programs |
|
|
238
|
+
| `EditorAndProgram` | Editor module that also compiles into standalone Programs |
|
|
239
|
+
| `Program` | Standalone programs (UnrealHeaderTool etc.) |
|
|
240
|
+
|
|
241
|
+
### Loading Phases
|
|
242
|
+
|
|
243
|
+
| Phase | Use for |
|
|
244
|
+
|---|---|
|
|
245
|
+
| `EarliestPossible` | First possible phase — core engine modules only |
|
|
246
|
+
| `PostSplashScreen` | After splash screen renders |
|
|
247
|
+
| `PreEarlyLoadingScreen` | Before the early loading screen |
|
|
248
|
+
| `PreLoadingScreen` | Before the main loading screen |
|
|
249
|
+
| `PostConfigInit` | Systems that must configure before engine starts |
|
|
250
|
+
| `PreDefault` | Modules that must be ready before Default modules |
|
|
251
|
+
| `Default` | Standard game modules (most common) |
|
|
252
|
+
| `PostDefault` | Modules that depend on Default modules being up |
|
|
253
|
+
| `PostEngineInit` | After full engine initialization |
|
|
254
|
+
| `None` | Not auto-loaded — requires `FModuleManager::LoadModule()` |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Creating a New Module
|
|
259
|
+
|
|
260
|
+
### Directory Structure
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
Source/
|
|
264
|
+
MyModule/
|
|
265
|
+
Public/
|
|
266
|
+
MyModule.h (optional module interface header)
|
|
267
|
+
MyClass.h
|
|
268
|
+
Private/
|
|
269
|
+
MyModule.cpp (module registration)
|
|
270
|
+
MyClass.cpp
|
|
271
|
+
MyModule.Build.cs
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Module Interface
|
|
275
|
+
|
|
276
|
+
```cpp
|
|
277
|
+
// Public/MyModule.h
|
|
278
|
+
#pragma once
|
|
279
|
+
#include "Modules/ModuleManager.h"
|
|
280
|
+
|
|
281
|
+
class IMyModule : public IModuleInterface
|
|
282
|
+
{
|
|
283
|
+
public:
|
|
284
|
+
static IMyModule& Get()
|
|
285
|
+
{
|
|
286
|
+
return FModuleManager::LoadModuleChecked<IMyModule>("MyModule");
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
static bool IsAvailable()
|
|
290
|
+
{
|
|
291
|
+
return FModuleManager::Get().IsModuleLoaded("MyModule");
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
```cpp
|
|
297
|
+
// Private/MyModule.cpp
|
|
298
|
+
#include "MyModule.h"
|
|
299
|
+
|
|
300
|
+
class FMyModule : public IMyModule
|
|
301
|
+
{
|
|
302
|
+
public:
|
|
303
|
+
virtual void StartupModule() override
|
|
304
|
+
{
|
|
305
|
+
// Initialize subsystems, register delegates, etc.
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
virtual void ShutdownModule() override
|
|
309
|
+
{
|
|
310
|
+
// Unregister delegates, clean up
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// Use IMPLEMENT_MODULE for non-gameplay modules
|
|
315
|
+
IMPLEMENT_MODULE(FMyModule, MyModule)
|
|
316
|
+
|
|
317
|
+
// Use IMPLEMENT_GAME_MODULE for modules containing UObject/gameplay code
|
|
318
|
+
// IMPLEMENT_GAME_MODULE(FMyModule, MyModule)
|
|
319
|
+
|
|
320
|
+
// Use IMPLEMENT_PRIMARY_GAME_MODULE for the main game module
|
|
321
|
+
// IMPLEMENT_PRIMARY_GAME_MODULE(FMyModule, MyGame, "MyGame")
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
The `IMPLEMENT_MODULE` macro (defined in `Modules/ModuleManager.h`) registers the module's initializer function. In DLL builds it registers a static `FModuleInitializerEntry` that maps the module name to its factory function. In monolithic builds it registers a static `FStaticallyLinkedModuleRegistrant`.
|
|
325
|
+
|
|
326
|
+
`FDefaultModuleImpl` and `FDefaultGameModuleImpl` are provided for modules that need no startup/shutdown logic — use them to avoid writing a class body.
|
|
327
|
+
|
|
328
|
+
### Add to .uproject
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"Name": "MyModule",
|
|
333
|
+
"Type": "Runtime",
|
|
334
|
+
"LoadingPhase": "Default"
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Creating a Plugin
|
|
341
|
+
|
|
342
|
+
### Directory Structure
|
|
343
|
+
|
|
344
|
+
```
|
|
345
|
+
Plugins/
|
|
346
|
+
MyPlugin/
|
|
347
|
+
MyPlugin.uplugin
|
|
348
|
+
Source/
|
|
349
|
+
MyPlugin/
|
|
350
|
+
Public/
|
|
351
|
+
IMyPlugin.h
|
|
352
|
+
Private/
|
|
353
|
+
MyPlugin.cpp
|
|
354
|
+
MyPlugin.Build.cs
|
|
355
|
+
MyPluginEditor/ (optional editor-only module)
|
|
356
|
+
Public/
|
|
357
|
+
Private/
|
|
358
|
+
MyPluginEditor.cpp
|
|
359
|
+
MyPluginEditor.Build.cs
|
|
360
|
+
Content/ (optional, for content plugins)
|
|
361
|
+
Resources/
|
|
362
|
+
Icon128.png
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### .uplugin File
|
|
366
|
+
|
|
367
|
+
```json
|
|
368
|
+
{
|
|
369
|
+
"FileVersion": 3,
|
|
370
|
+
"Version": 1,
|
|
371
|
+
"VersionName": "1.0",
|
|
372
|
+
"FriendlyName": "My Plugin",
|
|
373
|
+
"Description": "Does something useful.",
|
|
374
|
+
"Category": "Gameplay",
|
|
375
|
+
"CreatedBy": "MyStudio",
|
|
376
|
+
"CreatedByURL": "",
|
|
377
|
+
"DocsURL": "",
|
|
378
|
+
"MarketplaceURL": "",
|
|
379
|
+
"CanContainContent": true,
|
|
380
|
+
"IsBetaVersion": false,
|
|
381
|
+
"IsExperimentalVersion": false,
|
|
382
|
+
"Installed": false,
|
|
383
|
+
"Modules": [
|
|
384
|
+
{
|
|
385
|
+
"Name": "MyPlugin",
|
|
386
|
+
"Type": "Runtime",
|
|
387
|
+
"LoadingPhase": "Default"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
"Name": "MyPluginEditor",
|
|
391
|
+
"Type": "Editor",
|
|
392
|
+
"LoadingPhase": "Default"
|
|
393
|
+
}
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Plugin with Runtime + Editor Modules
|
|
399
|
+
|
|
400
|
+
The runtime module must not include editor-only headers. Gate editor code:
|
|
401
|
+
|
|
402
|
+
```cpp
|
|
403
|
+
// MyPlugin.Build.cs — runtime module
|
|
404
|
+
public class MyPlugin : ModuleRules
|
|
405
|
+
{
|
|
406
|
+
public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
|
|
407
|
+
{
|
|
408
|
+
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
409
|
+
|
|
410
|
+
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine" });
|
|
411
|
+
|
|
412
|
+
// Editor-only dependency, only when compiling an editor build
|
|
413
|
+
if (Target.bBuildEditor)
|
|
414
|
+
{
|
|
415
|
+
PrivateDependencyModuleNames.Add("UnrealEd");
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
```cpp
|
|
422
|
+
// MyPluginEditor.Build.cs — editor module
|
|
423
|
+
public class MyPluginEditor : ModuleRules
|
|
424
|
+
{
|
|
425
|
+
public MyPluginEditor(ReadOnlyTargetRules Target) : base(Target)
|
|
426
|
+
{
|
|
427
|
+
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
428
|
+
|
|
429
|
+
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "UnrealEd" });
|
|
430
|
+
PrivateDependencyModuleNames.Add("MyPlugin");
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Engine vs Project Plugins
|
|
436
|
+
|
|
437
|
+
**Engine plugins** (`Engine/Plugins/`): available to all projects using that engine installation. Ship with Epic or marketplace installs. **Project plugins** (`YourProject/Plugins/`): project-specific, travel with the project. When both exist with the same name, the project plugin wins.
|
|
438
|
+
|
|
439
|
+
**Content-only plugins**: No `Source/` directory, no `Modules` array in `.uplugin`. Contains only `Content/` and `Resources/`. Set `"CanContainContent": true`. Used for distributing Blueprint libraries and asset packs without C++ compilation.
|
|
440
|
+
|
|
441
|
+
**Edge case -- launcher vs source builds**: Launcher (binary) installs only include pre-built engine module binaries. Adding a dependency on an engine module not in the pre-built set causes LNK1104. Source builds from GitHub expose all engine modules. Use `Target.LinkType` to conditionally include source-build-only dependencies.
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## Resolving Build Errors
|
|
446
|
+
|
|
447
|
+
Most build errors fall into a few categories: **LNK2019** (missing dependency or missing `MODULENAME_API`), **C1083** (missing dependency or wrong include path under IWYU), **IWYU violations** (include every header each file directly uses), and **circular dependencies** (extract a shared interface module or use `DynamicallyLoadedModuleNames`). Guard editor-only code in runtime modules with `#if WITH_EDITOR` and `if (Target.bBuildEditor)` in Build.cs. See [references/common-build-errors.md](references/common-build-errors.md) for full error message lookup, causes, and fix patterns.
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Common Anti-Patterns
|
|
452
|
+
|
|
453
|
+
- **Putting everything in PublicDependencyModuleNames** — inflates transitive include paths for every downstream module. Only promote to public when your public headers require it.
|
|
454
|
+
- **Missing `MODULENAME_API` on exported symbols** — compiles fine within the module but causes LNK2019 for any other module that tries to call it.
|
|
455
|
+
- **Relying on transitive includes under IWYU** — under `bEnforceIWYU = true`, each file must include every header it uses directly, even if another include would pull it in.
|
|
456
|
+
- **Referencing editor modules from runtime modules without `#if WITH_EDITOR`** — fails in Shipping/Server builds where editor modules are excluded.
|
|
457
|
+
- **Wrong LoadingPhase** — a module that registers asset types too late causes missing type errors at startup. Use `PreDefault` or `PostConfigInit` when needed.
|
|
458
|
+
- **Not adding the module to .uproject** — UBT will not compile a module that isn't listed in `.uproject` or a `.uplugin`.
|
|
459
|
+
|
|
460
|
+
---
|
|
461
|
+
|
|
462
|
+
## Related Skills
|
|
463
|
+
|
|
464
|
+
- `/ue-cpp-foundations` — UObject macros (UCLASS, UPROPERTY, UFUNCTION), reflection, and what must be in public headers for UHT to process
|
|
465
|
+
|
|
466
|
+
For detailed Build.cs field reference, see [references/build-cs-reference.md](references/build-cs-reference.md).
|
|
467
|
+
For error message lookup, see [references/common-build-errors.md](references/common-build-errors.md).
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Checklist
|
|
472
|
+
|
|
473
|
+
Validate before considering the work done:
|
|
474
|
+
|
|
475
|
+
- [ ] Dependencies are private unless the public headers genuinely need them
|
|
476
|
+
- [ ] Module type and loading phase are correct for what the module does
|
|
477
|
+
- [ ] The project still builds for every target platform it claims to support
|
|
478
|
+
- [ ] Conventions in `docs/unreal/project-context.md` were read and followed
|
|
479
|
+
- [ ] The Common Mistakes section of this skill was reviewed against the change
|
|
480
|
+
|
|
481
|
+
**PASS** — every item holds. **CONCERNS** — the work stands but at least one item is unresolved and worth flagging to the user. **FAIL** — an item is violated in a way that breaks correctness, replication or the frame budget; fix it before handing the work over.
|
|
482
|
+
|
|
483
|
+
## Next Steps
|
|
484
|
+
|
|
485
|
+
- `/ue-packaging` — produce and verify a packaged build
|
|
486
|
+
- `/code-review` — architectural and quality review of the change
|
|
487
|
+
- `/commit` — conventional commit once the change is verified
|