Build Pipeline Manager
Overview
Allows Unity to be "Headless" and built via command line. This skill provides the C# static methods to be called by Unity's -executeMethod flag, enabling automated builds for CI/CD.
When to Use
- •Use for GitHub Actions / GitLab CI pipelines.
- •Use for building Nightly versions automatically.
- •Use to switch between "Dev" (Debug) and "Prod" (Release) builds securely.
- •Use to increment version numbers automatically.
Architecture
code
┌─────────────────────────────────────────────────────────────┐ │ CI/CD PIPELINE │ ├─────────────────────────────────────────────────────────────┤ │ │ │ CI SERVER (Bash/PowerShell) UNITY EDITOR (Headless) │ │ ┌───────────────────────┐ ┌───────────────────────────┐ │ │ │ "Unity.exe -batchmode"│──▶│ BuildCommand.Execute() │ │ │ │ "-executeMethod Build"│ │ 1. Set Defines (PROD) │ │ │ └───────────────────────┘ │ 2. Set Keystore Pass │ │ │ │ 3. BuildAddressables() │ │ │ │ 4. BuildPlayer() │ │ │ └─────────────┬─────────────┘ │ │ │ │ │ ▼ │ │ ┌───────────────────────────┐ │ │ │ ARTIFACT (APK / EXE) │ │ │ └───────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────────┘
Best Practices
- •✅ Accept arguments from command line (e.g.,
-buildVersion 1.0). - •✅ Always build Addressables before the Player build.
- •✅ Fail fast: throw exceptions if Scenes are missing.
- •✅ Secrets Management: Read keystore passwords from Environment Variables, never hardcode.
- •❌ NEVER put
Editorscripts in runtime assemblies (useEditor/folder).
Few-Shot Examples
Example 1: Build Method
User: "Create a build script for Android."
Agent:
csharp
public static void BuildAndroid()
{
BuildPlayerOptions opts = new BuildPlayerOptions();
opts.target = BuildTarget.Android;
opts.locationPathName = "Builds/Game.apk";
BuildPipeline.BuildPlayer(opts);
}
Example 2: CLI Usage
User: "How do I run this?"
Agent:
bash
"C:\Program Files\Unity\Hub\Editor\2022.3.0f1\Editor\Unity.exe" -quit -batchmode -projectPath "." -executeMethod BuildScript.BuildAndroid
Related Skills
- •
@version-control-git- Source of the build - •
@addressables-asset-management- Content build content