Unity-Technologies/UnityCsReference · error · ArgumentException
The output path "{buildParameters.outputPath}" doesn't exist
Error message
The output path "{buildParameters.outputPath}" doesn't exist What it means
Thrown by BuildAssetBundles when the outputPath directory does not exist on disk. Unlike BuildContentDirectory which attempts on-the-fly creation, BuildAssetBundles requires the output directory to already exist before the build starts.
Source
Thrown at Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs:763
buildParameters.targetPlatform = EditorUserBuildSettings.activeBuildTarget;
// Note: subtarget is associated with multiple enums, and 0 may have a specific meaning,
// so we only auto-set it when the target is also coming from the build settings
buildParameters.subtarget = EditorUserBuildSettings.GetActiveSubtargetFor(buildParameters.targetPlatform);
}
// For Standalone platforms, the Default subtarget means to use the current active one
if (GetBuildTargetGroup(buildParameters.targetPlatform) == BuildTargetGroup.Standalone &&
(StandaloneBuildSubtarget)buildParameters.subtarget == StandaloneBuildSubtarget.Default)
{
buildParameters.subtarget = EditorUserBuildSettings.GetActiveSubtargetFor(buildParameters.targetPlatform);
}
if (isBuildingPlayer)
throw new InvalidOperationException("Cannot build asset bundles while a build is in progress.");
if (!System.IO.Directory.Exists(buildParameters.outputPath))
throw new ArgumentException("The output path \"" + buildParameters.outputPath + "\" doesn't exist");
return BuildAssetBundlesInternal(buildParameters);
}
[NativeMethod(ThrowsException = true)]
private static extern AssetBundleManifest BuildAssetBundlesInternal(BuildAssetBundlesParameters buildParameters);
[FreeFunction("GetPlayerDataCache")]
internal static extern string GetDataCacheForBuildTarget(BuildTarget target, int subtarget);
[FreeFunction("GetPlayerDataSessionId")]
internal static extern string GetSessionIdForBuildTarget(BuildTarget target, int subtarget);
[FreeFunction("GetDataBuildDirtyInfoPath")]
internal static extern string GetBuildDirtyInfoForBuildTarget(BuildTarget target, int subtarget);
///<summary>Extract the CRC checksum for the given AssetBundle.</summary>
///<remarks>A 32-bit checksum is generated during the AssetBundle build process and recorded in the .manifest file and exposed by this method.</remarks>View on GitHub (pinned to 225b0fbdb5)
Solutions
- Create the output directory with Directory.CreateDirectory(outputPath) before calling BuildAssetBundles.
- Verify Directory.Exists(outputPath) returns true before the call and log the resolved absolute path if it fails.
- In CI, add an explicit mkdir step or a pre-build script that ensures the directory tree exists.
Example fix
// before string outputPath = "Build/Bundles"; BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64); // after string outputPath = "Build/Bundles"; Directory.CreateDirectory(outputPath); BuildPipeline.BuildAssetBundles(outputPath, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
Defensive patterns
Strategy: validation
Validate before calling
string EnsureOutputDirectory(string outputPath)
{
if (!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
return outputPath;
}
// Before BuildAssetBundles:
EnsureOutputDirectory(outputPath);
BuildPipeline.BuildAssetBundles(outputPath, options, target); Prevention
- Call Directory.CreateDirectory(outputPath) before every BuildAssetBundles invocation.
- In CI, add an explicit directory creation step in the build script.
- Log the resolved absolute path when the check fails to catch environment variable issues.
When it happens
Trigger: Calling BuildPipeline.BuildAssetBundles with an outputPath pointing to a directory that hasn't been created yet, or that was deleted between the check and the call.
Common situations: Build scripts that assume the output folder exists from a prior run, CI clean-room environments where build artifacts are wiped between runs, or paths derived from environment variables that resolve to non-existent directories.
Related errors
- Scene path "{0}" contains invalid directory separators.
- Invalid build path: '{buildPlayerOptions.locationPathName}'.
- BuildContentDirectoryParameters.outputPath cannot be empty
- AssetBundleBuild cannot be null.
- Cannot build asset bundles while a build is in progress.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/8e70b450c36dc1fa.
Report an issue: GitHub.