Antigravity × Unreal Engine 5 Plugin Production Guide — Designing Reusable Game Systems with AI for Multiple Titles
A production-grade guide to building UE5 plugins with Antigravity. Covers module design, build configuration, AI-friendly code separation, and distribution patterns for reusing one plugin across multiple titles.
I stopped halfway through rebuilding the code for this piece one evening. The save container in the first version was a UCLASS() declared inside a .cpp file, which Unreal Header Tool never sees. The CI example set $env:UE5_ROOT in one step and read it in the next, where it no longer exists. Both were shapes the agent had produced and I had pasted without asking a compiler. Looking back, I think the suggestions simply looked tidy enough that I skipped the boring part.
If you're starting a second or third UE5 title, you probably want inventory, save, and achievements out of the game module and into a plugin. Where people get stuck is almost always the .Build.cs dependency graph and the Public/Private boundary. Antigravity will happily propose both — but a proposal and a passing build are different things.
Let the agent draft the scaffolding; let my own compiler decide the boundaries. That's the line I settled on while revising this. What follows is a plugin layout that works well with Antigravity, built around three systems, targeting Unreal Engine 5.7–5.8 as of November 2026 (check the official release notes). A few parts I haven't been able to build on real hardware myself, and I say so where that applies.
Why "AI-friendly plugin structure" matters
Antigravity reads AGENTS.md and your file layout to decide what to generate. If you point it at a UE5 project, it tends to treat Source/<GameName>/ as one big module. Plugin headers under Plugins/ get read as separate context, and the agent often loses track of which symbols are exported and which are not.
The biggest casualty is the Public//Private/ split. UE5 only allows other modules to #include headers under Public/. Ask Antigravity to "write code that adds an item to the inventory" without giving it that boundary, and it will happily reach into a Private/ struct from your game module — which compiles in the plugin but fails to link in the consuming module with unresolved external symbol.
The starting point: split the plugin into an API layer and an implementation layer, and write that split down in an AGENTS.md the agent can read. Whether it raises suggestion quality will vary by project, but at minimum it lets you point at the exact rule a bad diff breaks.
Plugin skeleton: .uplugin and .Build.cs
Start with the file layout. We'll put the plugin at Plugins/CommonGameSystems/:
The split between Runtime and Editor is non-negotiable for shipping. Editor modules are stripped from packaged builds, so they're the right home for editor-only tools and asset actions. Skip this split early on and you'll spend a frustrating afternoon hunting down "missing Slate" or "unresolved UnrealEd" errors at packaging time.
Keep LoadingPhase at Default unless you have a written reason. Earlier phases such as PreDefault or PostConfigInit run your module's StartupModule() before engine initialization finishes, so code there that touches UAssetManager and friends will fail. Gameplay subsystems (UGameInstanceSubsystem) are created when the UGameInstance initializes anyway, so loading the module earlier buys you nothing.
The .Build.cs is the file Antigravity gets wrong most often. Keep this template at the top of the file so you can spot incorrect dependency additions in your diff:
// Copyright (c) Your Studio. All Rights Reserved.using UnrealBuildTool;public class CommonGameSystemsRuntime : ModuleRules{ public CommonGameSystemsRuntime(ReadOnlyTargetRules Target) : base(Target) { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; bUseUnity = false; // Faster per-file builds during plugin dev — turn on later // UBT adds Public/ and Private/ to the include paths automatically, // so don't add PublicIncludePaths / PrivateIncludePaths by hand PublicDependencyModuleNames.AddRange(new[] { "Core", "CoreUObject", "Engine", "GameplayTags", // identify item types via tags "DeveloperSettings", // data-driven settings }); PrivateDependencyModuleNames.AddRange(new[] { "OnlineSubsystem", // achievements (enable OnlineSubsystem in the .uplugin too) }); }}
I removed the two PublicIncludePaths lines from the first version. UBT already adds the module's Public/ and Private/ folders, and hand-written relative paths are an easy place to introduce a typo. If the agent adds them back, just delete them in the diff.
bUseUnity = false is a stylistic choice for production, but during plugin development it's a quality-of-life win. Single-file builds make it much easier to localize the file that broke when the AI's last suggestion didn't compile. Flip it back to true once the plugin stabilizes.
✦
Thank you for reading this far.
Continue Reading
What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.
WHAT YOU'LL LEARN
✦Structure your UE5 plugin's Public/Private boundary so Antigravity stops generating broken Build.cs files and unresolved external symbols
✦Walk away with three working systems — inventory, save, and achievements — complete with .uplugin and .Build.cs ready to drop into your project
✦Design version management, build isolation, and module dependency rules that hold up when you reuse a single plugin across two, three, or more shipped titles
Secure payment via Stripe · Cancel anytime
✦
Unlock This Article
Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.
System 1: Inventory — designing the API as a UActorComponent
Inventory is the system that tends to look the same across genres, so it's the natural starting point. Here's the public header (Public/Inventory/InventoryComponent.h):
Never drop the COMMONGAMESYSTEMSRUNTIME_API macro. Without it, the consuming module can call AddItem from header but fail to link with unresolved external symbol. Antigravity forgets this constantly — I run a habitual grep -n "_API " *.h over generated headers before committing.
Calling AddItem(Tag.Item.Health, 5) should fire OnInventoryChanged once and leave GetQuantity returning 5. When stack limits are hit, you'll see one broadcast per new slot opened.
Why GameplayTag over an enum? Tags branch cleanly in Blueprint, pair well with Data Tables, and — crucially — let your designers add new item types without forcing a C++ recompile. Enums force every new item to drag the entire team back through a build.
System 2: Save — implementing as a UGameInstanceSubsystem
USaveGame is fine on its own, but managing slot names, async writes, and load timing in every game gets tedious. A subsystem wrapper means your gameplay code becomes a one-liner: SaveSubsystem->SaveSlotAsync("AutoSave", OnDone).
The implementation creates an internal USaveGame subclass and bridges to UGameplayStatics::AsyncSaveGameToSlot. The first version of this piece declared that subclass with UCLASS() inside the .cpp. Unreal Header Tool only parses headers, so no reflection code is generated and the build fails. It belongs in its own header under Private/:
// Private/SaveSystem/CommonSaveContainer.h#pragma once#include "CoreMinimal.h"#include "GameFramework/SaveGame.h"#include "CommonSaveContainer.generated.h"// Internal type: no _API macro, lives in Private/UCLASS()class UCommonSaveContainer : public USaveGame{ GENERATED_BODY()public: UPROPERTY(SaveGame) TMap<FString, FString> KV;};
A note on error handling: AsyncSaveGameToSlot does not throw on disk-full or permission errors. It quietly returns bOk = false. If your game ignores that flag, you'll ship a "save succeeded silently but didn't" bug — the worst kind. Make it a team rule that the OnDone callback always pipes into a UI notification on failure. Antigravity tends to drop this callback handling unless you're explicit; it's a great line to write into your AGENTS.md.
System 3: Achievements — a thin wrapper over OnlineSubsystem
Achievement APIs differ across Steam, Epic, PSN, and Xbox just enough to be annoying. Wrap them in a thin UAchievementSubsystem and hide the store-specific code in Private/. Your gameplay code becomes AchievementSubsystem->Unlock("FirstClear") and stays portable.
In the .cpp, get the subsystem with Online::GetSubsystem(GetWorld()), then GetAchievementsInterface(). When either is unavailable — offline launch, store auth not done, dev builds without credentials — keep the request in a local queue and retry in FlushPending.
// Private/Achievements/AchievementSubsystem.cpp (core only)#include "Achievements/AchievementSubsystem.h"#include "OnlineSubsystem.h"#include "OnlineSubsystemUtils.h"#include "Interfaces/OnlineAchievementsInterface.h"void UAchievementSubsystem::Unlock(FName AchievementId){ ReportProgress(AchievementId, 100.f);}void UAchievementSubsystem::ReportProgress(FName AchievementId, float Percent){ float& Stored = Pending.FindOrAdd(AchievementId); Stored = FMath::Max(Stored, Percent); // only ever keep the higher progress FlushPending();}void UAchievementSubsystem::FlushPending(){ IOnlineSubsystem* OSS = Online::GetSubsystem(GetWorld()); if (!OSS || !OSS->GetAchievementsInterface().IsValid()) { return; } // keep it queued // Call IOnlineAchievements::WriteAchievements here and remove the IDs // from Pending only in the success callback (leave them on failure)}
An implementation that does if (!OSS) return; without keeping the entry in Pending ships a bug where achievements earned offline never arrive. In agent-written versions of this part, the queueing is the piece most easily lost, so it's the first thing to read in review. UE5 also has the separate Online Services API alongside OnlineSubsystem; which one to use depends on whether your target store's plugin supports it, so check the official docs before committing.
Telling Antigravity about your plugin: an AGENTS.md
Next, an AGENTS.md so the agent handles the plugin correctly. Which AGENTS.md files and rules get loaded, and from where, has shifted between versions, so confirm placement against the official Rules and Customization discovery docs. What I'd suggest is keeping the full file inside the plugin folder and adding one line to the workspace-root AGENTS.md: "When touching the plugin, read Plugins/CommonGameSystems/AGENTS.md." If the loading scope changes, one of the two still gets picked up.
# CommonGameSystems plugin — agent instructions## Module boundaries- Public API: `Plugins/CommonGameSystems/Source/CommonGameSystemsRuntime/Public/`- Internal: `Plugins/CommonGameSystems/Source/CommonGameSystemsRuntime/Private/`- Editor-only: `Plugins/CommonGameSystems/Source/CommonGameSystemsEditor/`## Rules for code generation1. Every public type/function MUST have `COMMONGAMESYSTEMSRUNTIME_API`2. Public/ headers MUST NOT `#include` anything from Private/3. Adding a new dependency to Build.cs requires a comment explaining why4. Any OnlineSubsystem code MUST null-check the subsystem and queue locally on failure5. UCLASS / USTRUCT declarations go in headers, never in .cpp files6. Build file paths with `FPaths::Combine`; never hard-code separators## Naming conventions- Subsystems: `UXxxSubsystem` (derive from GameInstanceSubsystem)- Actor components: `UXxxComponent`- Blueprint-callable functions: `BlueprintCallable` or `BlueprintPure`## Forbidden- Including `<GameName>/...` headers from inside this plugin (creates circular deps)- Referencing Editor-module headers from Runtime modules
Rules 5 and 6 were added after the fact — they are the two mistakes the first version of this piece actually contained. I haven't measured how much the file reduces errors, but being able to say "this breaks rule 5" makes review comments much shorter.
Common pitfalls
Three patterns that agent suggestions tend to produce, and that break the build.
Mixing up PublicDependencyModuleNames and PrivateDependencyModuleNames. If a header in Public/#includes a type, that type's module must be in PublicDependencyModuleNames. Antigravity often files things under Private because "the implementation uses it," which is wrong — the consuming module needs visibility too. The symptom is "missing header" errors when the game module tries to use your plugin.
LoadingPhase: PreDefault. Subsystem code that touches UAssetManager or UGameInstance will crash because those aren't initialized yet. Default unless you have a written reason otherwise.
Referencing Editor code from the Runtime module. Ask the agent to "also save the asset" and it may add UnrealEd to the Runtime Build.cs and #include "Editor.h". It works in the editor and fails in a packaged build, because UnrealEd isn't there. Put editor-only code in CommonGameSystemsEditor; if it truly must live in Runtime, wrap it in #if WITH_EDITOR and add the dependency only inside if (Target.bBuildEditor).
Isolating build failures
Most errors during plugin extraction tell you roughly which layer is wrong. Work through the "how to check" column before handing the problem to the agent.
Symptom (error text)
Likely cause
How to check
Fix
unresolved external symbol (LNK2019)
Public type/function missing COMMONGAMESYSTEMSRUNTIME_API
grep -L "_API" Public/**/*.h
Add the API macro to the class declaration
Cannot open include file (in the consuming module)
Consumer's Build.cs lacks the dependency, or the header is in Private/
Check the consumer's PublicDependencyModuleNames and the header location
Add the dependency or move the header to Public/
A type used by a plugin Public/ header can't be found
Its module is in PrivateDependencyModuleNames
Compare the header's #includes with the dependency lists
Move it to PublicDependencyModuleNames
generated.h not found / errors at GENERATED_BODY
UCLASS in a .cpp, or .generated.h not the last include
Check where the class lives and the include order
Move to a header; put .generated.h last
Works in editor, packaged build fails on UnrealEd
Runtime references an editor-only module
Search the Runtime Build.cs and for #include "Editor.h"
Move to the Editor module or wrap in WITH_EDITOR
Crash right after launch (inside StartupModule)
LoadingPhase too early
Check LoadingPhase in the .uplugin
Set it back to Default
If none of the rows match, close the editor, delete Binaries/ and Intermediate/, and see whether a clean build reproduces the error. Live Coding leftovers are sometimes the real cause.
Distributing the plugin: versioning and reuse
Once you're shipping the plugin to two or more games, version management becomes the actual bottleneck. My recommendation: keep the plugin in its own Git repository, and pull it into each game project either as a git submodule or a CI checkout under Plugins/.
Use MAJOR.MINOR.PATCH in VersionName, tag each release with the same number, and pin the submodule to that tag in each game:
# In the game repository: pin the plugin to v1.2.0git submodule add https://github.com/yourstudio/CommonGameSystems.git Plugins/CommonGameSystemscd Plugins/CommonGameSystems && git checkout v1.2.0 && cd ../..git add Plugins/CommonGameSystems && git commit -m "Pin CommonGameSystems v1.2.0"# Check which version you're ongrep '"VersionName"' Plugins/CommonGameSystems/CommonGameSystems.uplugin
In the .uproject, list only "Name" and "Enabled" for the plugin. The first version of this piece suggested putting a Git URL in MarketplaceURL to signal the version, but that field is meant to point at a store page and plays no part in pinning anything. If you want the agent to know the version, a line in the game's AGENTS.md — "CommonGameSystems is pinned to v1.2.0; change plugin code in the plugin repository" — is far more reliable.
For save compatibility, what matters is less the order of members than their names, types, and enum values. UPROPERTY fields written by SaveGameToSlot are serialized with their property names, so adding a member in the middle of a USTRUCT still lets old saves load. Renaming a property, changing its type, or renumbering a UENUM silently resets old data to defaults. If you must rename, keep the old property and migrate after load, or map old to new with [CoreRedirects] in DefaultEngine.ini. A line in AGENTS.md — "never change existing UPROPERTY names or types, or UENUM values" — stops the agent's "tidying up."
CI builds and Antigravity automation
If you're going to reuse the plugin across titles, CI is no longer optional — you need to build the plugin standalone whenever someone changes it. GitHub-hosted runners don't ship with Unreal Engine, so this assumes a self-hosted runner with the engine installed:
# .github/workflows/plugin-build.ymlname: Plugin Buildon: [push, pull_request]jobs: build: # Self-hosted Windows runner with the engine installed (match your labels) runs-on: [self-hosted, windows, ue5] env: UE5_ROOT: 'C:\Program Files\Epic Games\UE_5.8' # shared across all steps steps: - uses: actions/checkout@v4 - name: Build Plugin shell: pwsh run: | & "$env:UE5_ROOT\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin ` -Plugin="$pwd\CommonGameSystems.uplugin" ` -Package="$pwd\Build\CommonGameSystems" ` -TargetPlatforms=Win64 -Rocket if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
The first version set $env:UE5_ROOT inside one step's run and used it in the next. Each GitHub Actions step runs in a fresh shell, so the value is gone and RunUAT.bat is looked up on an empty path. Put it in the job's env: or write it to $GITHUB_ENV. BuildPlugin creates a temporary host project under -Package, so point that somewhere outside the repo or already in .gitignore.
Reading a failed log is a good job for Antigravity. What works is handing it the log and asking for "only the first error line and the file and module that produced it," then deciding yourself which row of the table above it matches — that way a wrong summary can't steer the fix.
Unit-testing the plugin with the UE5 Automation Framework
Plugins that ship to multiple titles need tests, and UE5's Automation Framework is a reasonable home for them. Add a tiny test module to the plugin and Antigravity can generate test cases from your AGENTS.md rules.
// Source/CommonGameSystemsTests/CommonGameSystemsTests.Build.csusing UnrealBuildTool;public class CommonGameSystemsTests : ModuleRules{ public CommonGameSystemsTests(ReadOnlyTargetRules Target) : base(Target) { bUseUnity = false; PublicDependencyModuleNames.AddRange(new[] { "Core", "CoreUObject", "Engine", "CommonGameSystemsRuntime", // <- the module under test }); }}
A simple test that verifies inventory stacking:
// Private/InventoryStackingTest.cpp#include "Misc/AutomationTest.h"#include "Inventory/InventoryComponent.h"IMPLEMENT_SIMPLE_AUTOMATION_TEST( FInventoryStackingTest, "CommonGameSystems.Inventory.Stacking", // UE 5.5+ spelling; 5.4 and earlier use EAutomationTestFlags::ApplicationContextMask EAutomationTestFlags_ApplicationContextMask | EAutomationTestFlags::SmokeFilter)bool FInventoryStackingTest::RunTest(const FString& Parameters){ UInventoryComponent* Inv = NewObject<UInventoryComponent>(GetTransientPackage()); // Assumes Item.Health is registered in the project's GameplayTags (unregistered tags error out) FGameplayTag Tag = FGameplayTag::RequestGameplayTag(FName("Item.Health")); // Add 250 health potions; should split across 3 slots (99, 99, 52) TestTrue(TEXT("Add 250"), Inv->AddItem(Tag, 250)); TestEqual(TEXT("Total"), Inv->GetQuantity(Tag), 250); // Remove 100; remaining should be 150 TestTrue(TEXT("Remove 100"), Inv->RemoveItem(Tag, 100)); TestEqual(TEXT("After remove"), Inv->GetQuantity(Tag), 150); return true;}
Register the test module in the .upluginModules list (for example with "Type": "UncookedOnly"). The EAutomationTestFlags spelling changed in UE 5.5, so if the agent produces the old form, match it to your engine version.
Open Window → Test Automation (or Tools → Session Frontend, depending on version), run the CommonGameSystems filter, and the test executes in-process. Once Antigravity sees the pattern it will propose cases like "remove from an empty inventory" or "add zero quantity." The expected values aren't always right, though, so decide for each one whether that boundary really should behave that way before keeping it.
The one gotcha: tests in this module link against CommonGameSystemsRuntime, which means a broken API change in the runtime module immediately breaks the test build. That's the point — failing tests catch ABI-level mistakes before they ship.
Iteration speed: hot reload and live coding
UE5's Live Coding patches .cpp changes into a running editor (default shortcut Ctrl+Alt+F11), so small behavior tweaks don't need an editor restart. How much faster that makes you depends on the machine and project size — I don't have measured numbers to offer.
Two points matter for plugin work:
Enable it in Editor Preferences → General → Live Coding. If you want layout changes such as new UPROPERTY members picked up too, look at the Reinstancing option on the same page — but layout changes can appear to apply while leaving state inconsistent, so closing the editor and rebuilding is the safer habit.
In the plugin's Build.cs, keep bUseUnity = false while you're iterating. Live Coding patches per .cpp file, so unity builds give you fewer "did anything actually compile?" moments.
There's a real pitfall here: Live Coding doesn't pick up changes to UPROPERTY flags or USTRUCT member layout. If you change a struct's serialization, you must close and reopen the editor — otherwise saved data and live data drift apart and you get bizarre crashes. Antigravity occasionally suggests UPROPERTY reorderings as "cleanups." Reject those when iterating; do them at module boundaries when you're ready to bump the plugin's VersionName.
Performance: when the inventory hits 10,000 items
The implementation above is fine for typical RPG inventories (50–500 slots). If you're building a survival or factory game where inventories run into the thousands, the linear-scan AddItem becomes a bottleneck. The realistic mitigation is to keep an auxiliary TMap<FGameplayTag, TArray<int32>> mapping each tag to the slot indices that hold it.
Antigravity can write this refactor surprisingly well if you give it the constraint as a comment at the top of the file:
// PERF: This component is used in survival games with up to 10,000 slots.// Keep AddItem/RemoveItem/GetQuantity at O(1) average for a given tag by// maintaining an auxiliary index. Items[] remains the source of truth.
With the comment in place the agent starts from the assumption that an index must be maintained. The two parts most likely to be missing are fixing up indices after RemoveAt shifts the slots, and rebuilding the index after LoadSlot; read those first. Keeping Items[] as the source of truth is the escape hatch: if the index is ever wrong, rebuild it from Items[].
Marketplace publishing: what actually changes
If you're considering listing the plugin on Fab (the successor to UE Marketplace), three additional constraints kick in:
The plugin must build cleanly on every engine version you list (submission requirements change, so check Fab's official documentation before submitting). Multi-version support means CI matrices, and at that point Antigravity earns its keep generating per-version conditional code (#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION >= 4).
All third-party dependencies must be license-cleared. The GameplayTags and OnlineSubsystem dependencies in our example ship with the engine, so we're fine; if you add nlohmann/json, that's a different conversation.
You need user-facing documentation. The boundaries and rules in AGENTS.md make a good skeleton for it; if the agent drafts it, walk through the steps yourself once to make sure they match the actual plugin.
For an internal-only plugin this overhead usually isn't worth it, but knowing the constraints up front saves refactoring if you decide to publish later.
Cross-platform development: Linux, Mac, and Windows in one repo
UE5 plugins regularly need to compile on Windows, Mac, and Linux when you're shipping to consoles or working with a remote team. The plugin we've built compiles cleanly on all three out of the box, but a few patterns are worth establishing now to avoid pain later.
The biggest cross-platform pitfall in plugin code is path-string handling. UE5's FPaths::ConvertRelativePathToFull and FPaths::Combine handle separators correctly across OSes; raw FString concatenation with "\\" does not. Antigravity will sometimes write Windows-flavored paths because of training-data bias, especially when generating editor-side asset utilities. The fix is a one-line AGENTS.md rule: "All filesystem paths must use FPaths::Combine — never raw separators."
For continuous integration, mirror your plugin-build.yml for each platform you support:
The first version passed -TargetPlatforms=Win64+Mac on a Windows runner. Mac builds need Xcode on a Mac, so that never works from Windows; each OS now builds only its own platform. When all four jobs pass, that's your signal to tag. Headers that compile on Windows but trip Mac's Clang — implicit conversions, a missing include — are exactly what this matrix tends to surface first.
For Linux, Epic does publish container images, but using them requires linking your Epic Games and GitHub accounts (see the official Containers documentation). Starting with Win64 and Mac and adding Linux when you actually need server builds seems the realistic order to me.
Operational hygiene: log channels and crash diagnostics
The last thing worth building into a production plugin from day one is a dedicated log channel. Adding DECLARE_LOG_CATEGORY_EXTERN(LogCommonGameSystems, Log, All); to your runtime module and routing all UE_LOG calls through it pays off the moment a customer reports a bug — you can pull just your plugin's log output instead of grepping through LogTemp noise.
Place this in CommonGameSystemsRuntime.h (the module's "main" public header):
Then update every UE_LOG(LogTemp, ...) in the plugin to use LogCommonGameSystems. Antigravity is good at this kind of mechanical refactor — feed it the plugin folder and ask "replace all LogTemp references in this module with LogCommonGameSystems," and it will do exactly that, including catching cases inside lambdas and macros.
For crash diagnostics, integrate with UE5's FGenericCrashContext if you ship to PC. Attaching plugin-level values (current version, last save slot, last achievement progress) as key/value game data — for example via FGenericCrashContext::SetGameData — gives you something to narrow down repro conditions with. Check the API reference for your engine version for what's available.
Where to put the code: game module, project plugin, or engine plugin
The same code costs different amounts of effort depending on where it lives. This assumes UE 5.7–5.8 as of November 2026.
Location
Good for
Effort
How well the agent reads it
Game module (Source/<GameName>/)
Code only this title uses
Minimal
High (read as one unit)
Separate in-game module (Source/<GameName>Core/)
You want a boundary but no second title yet
Small (one Build.cs)
Medium (module name shows the boundary)
Project plugin (Plugins/ + submodule)
A second title is committed
Medium (versioning and CI)
Medium–high (with an AGENTS.md)
Engine plugin / Fab distribution
Shipping to other teams or the public
Large (multi-version builds, review)
Low (often read-only)
If you're unsure, start with the second row. You build the Public/Private and _API discipline there, and the day a second game is confirmed, moving to Plugins/ is a folder move plus a .uplugin.
Three common misconceptions
"Adding a member in the middle of a USTRUCT corrupts saves." As covered above, UPROPERTY data is serialized by name, so adding is fine. What breaks saves is changing names, types, or enum values.
"MarketplaceURL in the .uproject pins the plugin version." That field points at a store page; neither the build nor Git looks at it. Pin with a submodule commit or tag.
"With Live Coding you never need to restart the editor." It handles function-body changes well, but class layout changes can apply unreliably. After any serialization-related change, close the editor and rebuild.
When NOT to extract a system into a plugin
Plugins are the right answer most of the time once you're shipping multiple titles, but a few patterns suggest the inline path is still better.
If a system is deeply coupled to the specific game's economy or progression curves — for example, a quest system whose state machine references game-specific narrative beats — extracting it forces you to invent generic abstractions that don't carry their weight. The "plugin overhead" tax (Build.cs, Public/Private split, version management) costs you more than the duplication does. Antigravity is good at suggesting these extractions early, but resist if the abstraction feels strained.
Another signal to keep code inline: the system is a one-off you'll only use in this game. Map travel logic, a credits scroller, the title-screen attract loop. There's no reuse story, so all of the plugin scaffolding is pure overhead. The bar I use is "would I copy this folder into a brand-new game project tomorrow without changes?" If the answer is "yes, with one or two parameters tweaked," it belongs in a plugin. If it's "yes, but I'd rewrite half of it for the new game's mechanics," it doesn't.
Finally: if the team is one or two people and you have a clear single shipping target, don't preemptively pluginize. The cost shows up as "AI suggests changes that span the plugin boundary, and you have to keep flipping between two folders" — friction that costs real time on small teams. Plugin extraction has the best ROI when (a) you've shipped at least once, (b) you have a second project committed, and (c) you can dedicate a half-day to the migration. Otherwise, ship the game first.
Where you'll get stuck next: using plugin types from game Blueprints
Right after extracting a plugin, a common snag is "it works from C++, but the component doesn't show up in the game's Blueprint list." Usually either the UCLASS lacks meta = (BlueprintSpawnableComponent), or the .uplugin has EnabledByDefault set to false and the game's .uproject never enables it. The header tells you the first; the .uprojectPlugins list tells you the second.
Extracting a plugin is not a light investment. If you only ever ship one game, the game module is faster. But on the day you start a second title, having the boundaries already drawn pays you back — as days of code you don't have to rewrite.
The line I redrew while revising this piece is the one at the top: the agent's scaffolding is a draft, and three things — _API macros, Build.cs dependencies, and save compatibility — only come in after my own compiler and tests agree.
If you take one step from here, move just your inventory into a separate module, Source/<GameName>Core/, write its one Build.cs, and get it building. If you then want to tighten how you brief the agent, Harness Engineering for Antigravity picks up from there.
Share
Thank You for Reading
Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.