{"record":{"id":"8bff2766a61ff5c5","repo":"Unity-Technologies/UnityCsReference","slug":"non-development-build-cannot-allow-deep-profiling","errorCode":null,"errorMessage":"Non-development build cannot allow deep profiling support. Either add the Development build option, or remove the EnableDeepProfilingSupport build option.","messagePattern":"Non-development build cannot allow deep profiling support\\. Either add the Development build option, or remove the EnableDeepProfilingSupport build option\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs","lineNumber":244,"sourceCode":"                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\n            {\n                if ((buildPlayerOptions.options & BuildOptions.EnableCodeCoverage) != 0)\n                {\n                    if (!BuildProfileModuleUtil.IsBuildTargetSupportedByCoverage(buildPlayerOptions.target))\n                        throw new ArgumentException(\"Code coverage is unavailable for the selected build target. Remove the EnableCodeCoverage build option.\");\n                }\n            }\n\n            try\n            {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs#L226-L262","documentation":"Thrown when BuildPlayer is called with BuildOptions.EnableDeepProfilingSupport set but BuildOptions.Development is NOT set. Deep profiling instruments every method call at the IL level, which is only available through the Development build pipeline.","triggerScenarios":"Calling BuildPipeline.BuildPlayer with a BuildOptions bitmask containing EnableDeepProfilingSupport without Development.","commonSituations":"Performance-investigation builds that enable deep profiling but inherit a release-oriented options base, or automated profiling scripts that set EnableDeepProfilingSupport independently of the Development flag.","solutions":["Add BuildOptions.Development to the options bitmask when EnableDeepProfilingSupport is required.","Remove BuildOptions.EnableDeepProfilingSupport if this is a release build.","Wrap BuildOptions construction in a helper that auto-adds Development when any dev-only profiling flag is present."],"exampleFix":"// before\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.EnableDeepProfilingSupport,\n    target = BuildTarget.StandaloneWindows64\n};\nBuildPipeline.BuildPlayer(options);\n\n// after\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.Development | BuildOptions.EnableDeepProfilingSupport,\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":["Deep profiling is expensive; only enable it in Development builds for profiling sessions.","Use the same EnsureDevelopment helper for all development-only flags.","Profile the build time impact of deep profiling before adding it to regular CI."],"tags":["unity","build-pipeline","build-options","profiling","development-build"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}