Unity-Technologies/UnityCsReference · error · ArgumentException
Non-development build cannot allow auto-connecting the profi
Error message
Non-development build cannot allow auto-connecting the profiler. Either add the Development build option, or remove the ConnectWithProfiler build option.
What it means
Thrown when BuildPlayer is called with BuildOptions.ConnectWithProfiler set but BuildOptions.Development is NOT set. Auto-connecting the profiler on launch requires the Development build's profiling transport and profiler hooks to be compiled into the player.
Source
Thrown at Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs:249
{
if ((buildPlayerOptions.options & BuildOptions.AllowDebugging) != 0)
{
throw new ArgumentException("Non-development build cannot allow debugging. Either add the Development build option, or remove the AllowDebugging build option.");
}
if ((buildPlayerOptions.options & BuildOptions.EnableCodeCoverage) != 0)
{
throw new ArgumentException("Non-development build cannot allow code coverage. Either add the Development build option, or remove the EnableCodeCoverage build option.");
}
if ((buildPlayerOptions.options & BuildOptions.EnableDeepProfilingSupport) != 0)
{
throw new ArgumentException("Non-development build cannot allow deep profiling support. Either add the Development build option, or remove the EnableDeepProfilingSupport build option.");
}
if ((buildPlayerOptions.options & BuildOptions.ConnectWithProfiler) != 0)
{
throw new ArgumentException("Non-development build cannot allow auto-connecting the profiler. Either add the Development build option, or remove the ConnectWithProfiler build option.");
}
}
else
{
if ((buildPlayerOptions.options & BuildOptions.EnableCodeCoverage) != 0)
{
if (!BuildProfileModuleUtil.IsBuildTargetSupportedByCoverage(buildPlayerOptions.target))
throw new ArgumentException("Code coverage is unavailable for the selected build target. Remove the EnableCodeCoverage build option.");
}
}
try
{
if (!BuildPlayerWindow.DefaultBuildMethods.IsBuildPathValid(buildPlayerOptions.locationPathName, out var msg))
throw new ArgumentException($"Invalid build path: '{buildPlayerOptions.locationPathName}'. {msg}");
if (buildPlayerOptions.targetGroup == BuildTargetGroup.Standalone)
{View on GitHub (pinned to 225b0fbdb5)
Solutions
- Add BuildOptions.Development to the options bitmask alongside ConnectWithProfiler.
- Remove BuildOptions.ConnectWithProfiler if this is intended as a release build.
- Use a pre-build validation function that enforces the Development dependency for all profiling-related flags.
Example fix
// before
var options = new BuildPlayerOptions
{
options = BuildOptions.ConnectWithProfiler,
target = BuildTarget.StandaloneWindows64
};
BuildPipeline.BuildPlayer(options);
// after
var options = new BuildPlayerOptions
{
options = BuildOptions.Development | BuildOptions.ConnectWithProfiler,
target = BuildTarget.StandaloneWindows64
};
BuildPipeline.BuildPlayer(options); Defensive patterns
Strategy: validation
Validate before calling
BuildOptions EnsureDevelopmentForDevOnlyFlags(BuildOptions options)
{
BuildOptions devOnlyFlags = BuildOptions.AllowDebugging |
BuildOptions.EnableCodeCoverage |
BuildOptions.EnableDeepProfilingSupport |
BuildOptions.ConnectWithProfiler;
if ((options & devOnlyFlags) != 0 && (options & BuildOptions.Development) == 0)
options |= BuildOptions.Development;
return options;
}
// Before BuildPlayer:
options.options = EnsureDevelopmentForDevOnlyFlags(options.options); Prevention
- ConnectWithProfiler requires Development — always pair them.
- Use the same EnsureDevelopment helper for all development-only flags.
- Verify the profiler connection in a Development build before automating it in CI.
When it happens
Trigger: Calling BuildPipeline.BuildPlayer with a BuildOptions bitmask containing ConnectWithProfiler without Development.
Common situations: Build scripts that enable profiler auto-connect for automated performance testing but omit the Development flag, or options copied from a profiling template where Development was stripped.
Related errors
- Non-development build cannot allow debugging. Either add the
- Non-development build cannot allow code coverage. Either add
- Non-development build cannot allow deep profiling support. E
- Code coverage is unavailable for the selected build target.
- Scene path "{0}" contains invalid directory separators.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/8d72c8fec540c17c.
Report an issue: GitHub.