{"record":{"id":"8d72c8fec540c17c","repo":"Unity-Technologies/UnityCsReference","slug":"non-development-build-cannot-allow-auto-connecting","errorCode":null,"errorMessage":"Non-development build cannot allow auto-connecting the profiler. Either add the Development build option, or remove the ConnectWithProfiler build option.","messagePattern":"Non-development build cannot allow auto-connecting the profiler\\. Either add the Development build option, or remove the ConnectWithProfiler build option\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs","lineNumber":249,"sourceCode":"            {\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            {\n                if (!BuildPlayerWindow.DefaultBuildMethods.IsBuildPathValid(buildPlayerOptions.locationPathName, out var msg))\n                    throw new ArgumentException($\"Invalid build path: '{buildPlayerOptions.locationPathName}'. {msg}\");\n\n                if (buildPlayerOptions.targetGroup == BuildTargetGroup.Standalone)\n                {","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/Unity-Technologies/UnityCsReference/blob/225b0fbdb57cc17d094e8056b71f8314aba56f73/Editor/Mono/BuildPipeline/BuildPipeline.bindings.cs#L231-L267","documentation":"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.","triggerScenarios":"Calling BuildPipeline.BuildPlayer with a BuildOptions bitmask containing ConnectWithProfiler without Development.","commonSituations":"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.","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."],"exampleFix":"// before\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.ConnectWithProfiler,\n    target = BuildTarget.StandaloneWindows64\n};\nBuildPipeline.BuildPlayer(options);\n\n// after\nvar options = new BuildPlayerOptions\n{\n    options = BuildOptions.Development | BuildOptions.ConnectWithProfiler,\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":["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."],"tags":["unity","build-pipeline","build-options","profiler","development-build"],"backgroundTag":null,"analyzedSha":"225b0fbdb57cc17d094e8056b71f8314aba56f73","analyzedAt":"2026-08-13T19:07:19.849Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}