Unity "BuildFailedException" from BuildPipeline in CI
Unity ran your build method, BuildPipeline.BuildPlayer returned a report with result Failed, and the wrapper raised BuildFailedException. The real cause is a compile error or a build callback higher in the log.
What this error means
A batchmode build ends with "BuildFailedException: Build failed with errors" and a non-zero exit code, after script compilation or a build callback reported problems.
UnityEditor.BuildPlayerWindow+BuildMethodException: 1 errors
Build completed with a result of 'Failed'
BuildFailedException: Build failed with errors.Common causes
Compile errors in editor or player scripts
Code that compiles in your local editor can fail in CI when an editor-only assembly, define, or platform differs, producing errors before the player is built.
A build callback threw
An IPreprocessBuildWithReport or post-process step (addressables, an asset bundle, a custom script) raised an exception that fails the build report.
How to fix it
Read the first error above the exception
- Scroll up to the first
error CSor callback exception in the log. - Fix the compile error or guard the platform-specific code with the right define.
- Re-run;
BuildFailedExceptionis only the summary, not the cause.
Reproduce the exact build method locally
Run the same -executeMethod in batchmode locally so the compile and callback path matches CI.
Unity -batchmode -nographics -quit \
-projectPath . -executeMethod BuildScript.PerformBuild \
-logFile -How to prevent it
- Keep editor-only code inside Editor assemblies or
#if UNITY_EDITOR. - Guard platform code with the matching scripting defines.
- Test the batchmode build method locally before pushing.