How do you make a development Build with ScriptsDebugging disabled?

I have been unable to get a cloud build working with Development enabled, but scripts debugging disabled.

This is very important as I need to do performance profiling on device, however scripts debugging incurs a large performance overhead, which is especially bad with certain assets such as Cinemachine. (It generates 6-7ms of overhead per frame, but in a local build with ScriptsDebugging disabled, this drops to less than 1ms.)

I have tried a pre-export method, and calling EditorUserBuildSettings.allowDebugging = false. However, according to the below post, this does not work:

However that post is a few years old, and I am really hoping that things have changed since then since making a Development build for profiling, without the overhead of scripts debugging seems like a very common use case for cloud builds.

I have verified my pre-export method gets called correctly, by using Debug.Log and ensuring that the log is included in the build log.

That post is still accurate, all BuildOptions need to be passed in to BuildPipeline.BuildPlayer and as a result they cannot be altered easily by users. We do not have a UI for adding arbitrary BuildOptions to the player since we haven’t really encountered any demand for it, however the build API is fully documented and available for power users to do unexpected tasks like this.

You should be able to configure a build to run with only BuildOptions.Development using the follow cURL script - just fill out everything in the curly brackets. Your API key is available from Settings → Cloud Build in the dashboard.

curl --request PUT 'https://build-api.cloud.unity3d.com/api/v1/orgs/{orgName}/projects/{projectName}/buildtargets/{targetName}' \
--header 'authorization: Basic {API_KEY_GOES_HERE}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "settings": {
        "advanced": {
            "unity": {
                "playerExporter": {
                    "buildOptions": [
                        "Development"
                    ]
                }
            }
        }
    }
}'

Our Android UCB ‘Development’ flagged builds are failing for this reason (Android NDK r19 bug)

Triggering them using the above API call fixes this, but is also there a way to disable ‘ScriptDebugging’ for the UCB auto-builds?

BuildOptions are one of those things that isn’t needed until you do. I’ve been using UCB for a few years now, and just ran into this exact issue. In-app performance is worse with Script Debugging enabled.

There is something else I noticed that would make quality-of-life better for all developers using UCB in general. Builds with Script Debugging enabled take substantially longer to build. I am happy that Unity 2020 shows a build timer.
For my project, a local build with Script Debugging took 17 minutes vs 5 minutes without it. I took a look at debug vs release builds on UCB and confirmed that the time differences are almost exactly the same.

Script debugging is not needed on basically all UCB debug builds on our team, so we are waiting substantially longer on UCB for no reason. Debug builds are also our primary build type. Currently we are on dev build 585 and release build 39.

Hopefully, the Unity team will consider the impact of having Script Debugging as an option that can’t be changed. The build API is just not convenient enough. For now, we are going to deal with long build times.

@TechCor Thanks for this data point – very helpful. Have taken note on this and will work with the team to get this on our roadmap.

Probably the simple solution will be adding one more checkbox like Disable Scripts Debugging. It should be 30 minutes fix for the cloud build team and lots of convenience for all developers.

5 Likes