gamedev-skills/awesome-gamedev-agent-skills / skills/unity/unity-build-pipeline
unity-build-pipeline
VerifiedBuilds and ships Unity 6.3 LTS players: Build Profiles, IL2CPP vs Mono, managed stripping with link.xml, scripted BuildPlayer, Addressables and CI or headless builds. Use when automating a Unity build or MissingMethodException appears only in the player. Not for a build that is too big (`unity-build-size`) or store uploads (`steam-publish`, `itch-publish`).
Unity Build Pipeline
Configure, script, and automate Unity 6.3 LTS player builds: scenes, platform target, scripting backend, stripping, and headless/CI builds. Targets Unity 6.3 LTS (6000.3).
When to use
- Use when setting up Build Settings/Profiles, choosing a platform and scripting backend
(Mono vs IL2CPP), reducing build size with managed stripping, scripting a repeatable build
with
BuildPipeline.BuildPlayer, or wiring a CI/headless build. - Use when the project has
ProjectSettings/EditorBuildSettings.assetor a CI build script.
When not to use: authoring a CI service config end-to-end is DevOps; this skill covers
the Unity-side build API and settings. Console/platform certification specifics are
platform-NDA territory. Storefront submission → steam-publish / itch-publish. A build, APK
or Web build that is too large (assets, compression, per-platform size settings) →
unity-build-size, which sends stripping work back here.
Core workflow
- List the scenes to build (File → Build Profiles → Scene List, or
EditorBuildSettings.scenes). Only listed, enabled scenes ship; scene 0 is the start scene. A Build Profile asset can carry its own Scene List (Add Settings → Scene List); when it does, that profile builds its list, not the global one. - Pick the platform target and switch the active build target if needed
(
BuildTarget/EditorUserBuildSettings). In batch mode, pass-buildTarget <name>on the command line instead:SwitchActiveBuildTargetis not available there. - Choose the scripting backend (Player Settings): Mono (fast iteration, desktop) vs IL2CPP (AOT C++; required for many platforms, better perf, harder to reverse). IL2CPP needs the platform's C++ toolchain installed. (Forward note: Unity is developing a CoreCLR backend as a modern .NET runtime successor to Mono, but in the Unity 6.7 beta it is still experimental, desktop-only, and documented as not suitable for production — so for 6.3 LTS the choice stays Mono vs IL2CPP.)
- Tune size/perf: set Managed Stripping Level (Disabled → Minimal → Low → Medium → High)
and protect reflection-only code with a
link.xml. Set Quality Settings per platform. - Script the build with
BuildPipeline.BuildPlayer(BuildPlayerOptions)and inspect the returnedBuildReport— a non-Succeededresult must fail your pipeline. - Run headless for CI with
-batchmode -quit -executeMethod, and check the exit code. - Verify the actual output runs (launch the player), not just that the build returned without throwing.
Patterns
1. Scripted build with a result check
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
public static class BuildScript
{
[MenuItem("Build/Windows x64")]
public static void BuildWindows()
{
var options = new BuildPlayerOptions
{
scenes = new[] { "Assets/Scenes/Main.unity", "Assets/Scenes/Level1.unity" },
locationPathName = "Builds/Windows/Game.exe",
target = BuildTarget.StandaloneWindows64,
options = BuildOptions.None, // add BuildOptions.Development for a dev build
};
BuildReport report = BuildPipeline.BuildPlayer(options);
BuildSummary summary = report.summary;
if (summary.result != BuildResult.Succeeded)
throw new System.Exception($"Build failed: {summary.totalErrors} errors");
Debug.Log($"Build OK: {summary.totalSize} bytes in {summary.totalTime}");
}
}
2. Headless / CI invocation
# Exit code is 0 on success; -quit ensures the editor closes; -nographics for build servers.
# -buildTarget makes the Editor start on that platform, so scripts compile with its defines.
Unity -batchmode -quit -nographics \
-projectPath "/path/to/Project" \
-buildTarget win64 \
-executeMethod BuildScript.BuildWindows \
-logFile -
3. Build a saved Build Profile
using UnityEditor;
using UnityEditor.Build.Profile;
using UnityEditor.Build.Reporting;
public static class ProfileBuild
{
[MenuItem("Build/Windows Release Profile")]
public static void Build()
{
var profile = AssetDatabase.LoadAssetAtPath<BuildProfile>(
"Assets/Settings/Build Profiles/WindowsRelease.asset");
var options = new BuildPlayerWithProfileOptions
{
buildProfile = profile, // platform, scene list, defines from the asset
locationPathName = "Builds/Windows/Game.exe",
options = BuildOptions.None,
};
BuildReport report = BuildPipeline.BuildPlayer(options);
if (report.summary.result != BuildResult.Succeeded)
throw new System.Exception($"Build failed: {report.summary.totalErrors} errors");
}
}
4. Protect stripped code with link.xml
<!-- Assets/link.xml — keep types the linker can't see are used (reflection, JSON, plugins). -->
<linker>
<assembly fullname="MyGameRuntime" preserve="all"/>
</linker>
Gotchas
- A scene loads in the Editor but is missing in the build — it isn't in the scene list
(File → Build Profiles → Scene List, or the built profile's own list) or is disabled.
SceneManager.LoadSceneonly sees listed scenes. - IL2CPP build fails on a fresh machine — the platform C++ toolchain (e.g. Windows build tools, Android NDK) isn't installed. Mono has no such requirement.
MissingMethodException/TypeLoadExceptiononly in the build — managed stripping removed reflection-only code. Lower the stripping level or add alink.xmlpreserve entry.- Treating "BuildPlayer returned" as success — always check
BuildReport.summary.result; it can return with errors. - Addressables content is stale/missing — Addressables (
com.unity.addressables) content is built by Build → Addressables or byAddressableAssetSettings.BuildPlayerContent. The Build Addressables on Player Build setting can do it during a player build, but when it is left at "Use global Settings" the result depends on each machine's Preferences — call the content build explicitly in CI, and check the profile's load path. - The build platform's code didn't compile in — a scripted
BuildPlayerfor a target other than the active one keeps the active platform'sUNITY_*defines, and define changes only apply after a domain reload. Switch platform first (in the Editor) or launch with-buildTarget(batch mode). - Build ignores scenes you added to the global list — the Build Profile you build has its own Scene List. Edit that list; a profile without a Scene List uses the global one.
- Shipping a Development build —
BuildOptions.Developmentenables the profiler/debugging and is slower; useBuildOptions.Nonefor release.
References
- For a complete multi-platform CI build script (
-buildTargetper platform, version stamping, argument parsing, exit codes), building a Build Profile from the command line, and an Addressables content-build call, readreferences/ci-build-script.md. - Primary docs:
ScriptReference/BuildPipeline.BuildPlayer,ScriptReference/BuildPlayerWithProfileOptions, the Manual pages "Editor command line arguments" and "Manage scenes in a build", and Unity Manual build sections (player settings, managed code stripping). For the forward-looking CoreCLR backend, see the experimental note athttps://docs.unity.com/en-us/engine/6000.7/manual/programming-environment/scripting-backends/coreclr.
Related skills
steam-publish/itch-publish— distributing the player you just built.unity-csharp-scripting— editor scripting conventions used by build scripts.unity-build-size— finding and shrinking what makes a build, APK or Web build large.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |