{"record":{"id":"bb97ca1af7527c15","repo":"Unity-Technologies/UnityCsReference","slug":"non-development-build-cannot-allow-debugging-eith","errorCode":null,"errorMessage":"Non-development build cannot allow debugging. Either add the Development build option, or remove the AllowDebugging build option.","messagePattern":"Non-development build cannot allow debugging\\. Either add the Development build option, or remove the AllowDebugging build option\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs","lineNumber":234,"sourceCode":"            {\n                CanAppendBuild canAppend = BuildCanBeAppended(buildPlayerOptions.target, buildPlayerOptions.locationPathName);\n                if (canAppend == CanAppendBuild.Unsupported)\n                    throw new InvalidOperationException(\"The build target does not support build appending.\");\n                if (canAppend == CanAppendBuild.No)\n                    throw new InvalidOperationException(\"The build cannot be appended.\");\n            }\n\n            if (buildPlayerOptions.scenes != null)\n            {\n                for (int i = 0; i < buildPlayerOptions.scenes.Length; i++)\n                    buildPlayerOptions.scenes[i] = buildPlayerOptions.scenes[i].Replace('\\\\', '/').Replace(\"//\", \"/\");\n            }\n\n            if ((buildPlayerOptions.options & BuildOptions.Development) == 0)\n            {\n                if ((buildPlayerOptions.options & BuildOptions.AllowDebugging) != 0)\n                {\n                    throw new ArgumentException(\"Non-development build cannot allow debugging. Either add the Development build option, or remove the AllowDebugging build option.\");\n                }\n\n                if ((buildPlayerOptions.options & BuildOptions.EnableCodeCoverage) != 0)\n                {\n                    throw new ArgumentException(\"Non-development build cannot allow code coverage. Either add the Development build option, or remove the EnableCodeCoverage build option.\");\n                }\n\n                if ((buildPlayerOptions.options & BuildOptions.EnableDeepProfilingSupport) != 0)\n                {\n                    throw new ArgumentException(\"Non-development build cannot allow deep profiling support. Either add the Development build option, or remove the EnableDeepProfilingSupport build option.\");\n                }\n\n                if ((buildPlayerOptions.options & BuildOptions.ConnectWithProfiler) != 0)\n                {\n                    throw new ArgumentException(\"Non-development build cannot allow auto-connecting the profiler. Either add the Development build option, or remove the ConnectWithProfiler build option.\");\n                }\n            }\n            else","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs#L216-L252","documentation":"Thrown when BuildPlayer is called with BuildOptions.AllowDebugging set but BuildOptions.Development is NOT set. Script debugging attaches a debugger to the running player, which requires the Development build pipeline that includes debugging symbols and the debug transport.","triggerScenarios":"Calling BuildPipeline.BuildPlayer with a BuildOptions combination that includes AllowDebugging but does not include Development — e.g., options = BuildOptions.AllowDebugging or options = BuildOptions.AllowDebugging | BuildOptions.CompressWithLz4.","commonSituations":"A build script toggles individual debug flags without ensuring Development is set, or a release-oriented build pipeline accidentally inherits a debugging option from shared configuration. Also happens when copying BuildOptions from a development preset into a release build.","solutions":["Add BuildOptions.Development to the options bitmask when AllowDebugging is required.","Remove BuildOptions.AllowDebugging from the options bitmask if this is intended to be a release build.","Create a helper that automatically sets Development when any development-only flag (AllowDebugging, EnableCodeCoverage, EnableDeepProfilingSupport, ConnectWithProfiler) is present."],"exampleFix":"// before\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.AllowDebugging,\n    target = BuildTarget.StandaloneWindows64\n};\nBuildPipeline.BuildPlayer(options);\n\n// after\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.Development | BuildOptions.AllowDebugging,\n    target = BuildTarget.StandaloneWindows64\n};\nBuildPipeline.BuildPlayer(options);","handlingStrategy":"validation","validationCode":"BuildOptions EnsureDevelopmentForDevOnlyFlags(BuildOptions options)\n{\n    BuildOptions devOnlyFlags = BuildOptions.AllowDebugging |\n        BuildOptions.EnableCodeCoverage |\n        BuildOptions.EnableDeepProfilingSupport |\n        BuildOptions.ConnectWithProfiler;\n\n    if ((options & devOnlyFlags) != 0 && (options & BuildOptions.Development) == 0)\n        options |= BuildOptions.Development;\n    return options;\n}\n\n// Before BuildPlayer:\noptions.options = EnsureDevelopmentForDevOnlyFlags(options.options);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create a helper that auto-adds BuildOptions.Development when any development-only flag is present.","Never set AllowDebugging, EnableCodeCoverage, EnableDeepProfilingSupport, or ConnectWithProfiler without also setting Development.","Centralize BuildOptions construction in a single factory method per build configuration."],"tags":["unity","build-pipeline","build-options","debugging","development-build"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}