unity-azure-pipelines-tasks icon indicating copy to clipboard operation
unity-azure-pipelines-tasks copied to clipboard

Default Build Command includes non-enabled scenes

Open JohnConbere opened this issue 5 years ago • 1 comments

In unity-build-script.helper.ts Lines 31-37 when the scenes get added to the list of scenes to build there is no check to see if the scene is enabled.

EditorBuildSettingsScene[] editorConfiguredBuildScenes = EditorBuildSettings.scenes;
string[] includedScenes = new string[editorConfiguredBuildScenes.Length];
                
for (int i = 0; i < editorConfiguredBuildScenes.Length; i++)
{
    includedScenes[i] = editorConfiguredBuildScenes[i].path;
}

Instead it should check if the scene is enabled before adding:

                int enabledSceneCount = 0;
                for (int i = 0; i < editorConfiguredBuildScenes.Length; i++)
                {
                    if (editorConfiguredBuildScenes[i].enabled)
                    {
                        enabledSceneCount++; 
                    }
                }

                string[] includedScenes = new string[enabledSceneCount];
                int j = 0;
                for (int i = 0; i < editorConfiguredBuildScenes.Length; i++)
                {
                    if (editorConfiguredBuildScenes[i].enabled)
                    {
                        includedScenes[j] = editorConfiguredBuildScenes[i].path;
                        j++;
                    }
                }

JohnConbere avatar May 11 '20 21:05 JohnConbere

Thank you, this seems like a trivial fix. I'll put it in the next patch release.

FejZa avatar May 12 '20 21:05 FejZa