Unity 6 'Default' is not a valid subtarget for the Standalone build target
Running a pretty basic windows build returns the error 'Default' is not a valid subtarget for the Standalone build target. I am unable to get around this error.
I believe it is due to (int)StandaloneBuildSubtarget no longer contains Default it is now only Player and Server.
I confirm I have the same issue on the latest dev codebase with Unity 6. Out of curiosity, it did build the project after I changed the obsolete methods in BuildProject.cs and brute-forced NamedBuildTarget.Standalone with StandaloneBuildSubtarget.Player in a few places, but I’ll wait for a proper fix.
Thanks for the reports, @brentopc and @ArielJurkowski! I've been able to reproduce this using the v8.0.0-pre.1 release on Unity 6, so will target v8.0.0 for a fix when I have some time to look into it further.
@ArielJurkowski or @robinnorth I'm hitting this also, can you share how you set StandaloneBuildSubtarget to get it to work?
Hate to be a pain and bump a topic but is there any news on this one? I'm setting up some project build pipelines and aim to do some tutorials on them. I would love to do it through SUB but its actively broken at the moment with this issue.
Great job on the build tools in general though. I only found them recently and the inspect tooling is very elegant and clean!
I'm curious too. I had to abandon this tool because of it.
I am currently using this tool and do not have this issue anymore, the fix that was suggested has worked for me.
From: TenasticImmerser @.> Sent: Tuesday, March 18, 2025 9:09:44 PM To: superunitybuild/buildtool @.> Cc: Brentopc @.>; Mention @.> Subject: Re: [superunitybuild/buildtool] Unity 6 'Default' is not a valid subtarget for the Standalone build target (Issue #153)
I'm curious too. I had to abandon this tool because of it.
— Reply to this email directly, view it on GitHubhttps://github.com/superunitybuild/buildtool/issues/153#issuecomment-2735056169, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXGEZVBBZHXLP3YPXG3ZQZT2VC7VRAVCNFSM6AAAAABVN62TAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZVGA2TMMJWHE. You are receiving this because you were mentioned.Message ID: @.***>
[NobelImmerser]NobelImmerser left a comment (superunitybuild/buildtool#153)https://github.com/superunitybuild/buildtool/issues/153#issuecomment-2735056169
I'm curious too. I had to abandon this tool because of it.
— Reply to this email directly, view it on GitHubhttps://github.com/superunitybuild/buildtool/issues/153#issuecomment-2735056169, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AXGEZVBBZHXLP3YPXG3ZQZT2VC7VRAVCNFSM6AAAAABVN62TAWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZVGA2TMMJWHE. You are receiving this because you were mentioned.Message ID: @.***>
@jason-storey I have started working on a fix for this, so hopefully it will be resolved soon. Thanks for the kind words about SuperUnityBuild!
I'm very interested in using this. If you currently use this from Unity 6, it will corrupt your player state, the only fix being to delete the Library folder. This is very bad.
The mutation happening here is never undone. It looks like it should be undone here and maybe some other places.
I think part of the problem is that a lot of parsing/storage of the BuildTarget's SubTarget is defaulted to 0, which silently corrupts data, as 0 is a "valid" enum value (Default), so the rest of the code treats the lack of data as a presence of data, then does the wrong thing.
But @robinnorth, you're the expert, this is just my side analysis. Was going to try to submit a patch, but this looks pretty involved, as a lot of this data will be persisted already by users (BuildTarget.subTarget, in particular).
Would love to have this tool in my arsenal, it looks very useful. If you need manpower and have a rough design / guidelines for what the changes should be, happy to contribute back in a directed fashion, feel free to reach out to me here or over email.
Forgot the last time this issue screwed over my project... anyway been months and was trying it again.. and yup
in the library folder deleting 'EditorUserBuildSettings.asset' seems to get rid of the error and save the hassle of library import (hopefully.. just gonna test a build and make sure, hopefully fixed
Any news on Unity 6 support? I updated our game from 2022 to Unity 6, but SuperUnityBuild doesn't really work with it.
https://github.com/superunitybuild/buildtool/pull/155 I created this pull request with a fix
#155 I created this pull request with a fix
That was the only thing that was needed ? That works? just this has bricked project before so don't want to try it again without knowing for
#155 I created this pull request with a fix
That was the only thing that was needed ? That works? just this has bricked project before so don't want to try it again without knowing for
From my tests, yes.
As for bricking your project, there is a way to get out of the compile loop. If you switch to a different build platform (I think I picked Web) from your build profiles and then restart Unity it should restart without issue, and then build (Windows) manually from the build (profiles) popup and it should be fine again. I'm not 100% on the steps to get out of it but I know it's possible (it took me some attempts to fix it and I only used the one project)
from my previous test I think "in the library folder deleting 'EditorUserBuildSettings.asset' seems to get rid of the error and save the hassle of library import (hopefully.. just gonna test a build and make sure, hopefully fixed" is what had worked, but its still faff to find out and test.., so I'll let someone brave the testing and let us know it works again
#155 I created this pull request with a fix
I tried it out, it does work fine on Windows desktop anyway, so it should works fine with the other platform aswel then?
Some reason on 6.2 this error is back even with using the previous mentioned fix of public BuildTarget(UnityBuildTarget type, string name, bool enabled, string binaryNameFormat, int subtarget = 2) on buildtarget.cs
ArgumentException: 'Default' is not a valid subtarget for the Standalone build target
UnityEditor.Build.NamedBuildTarget.FromTargetAndSubtarget (UnityEditor.BuildTarget target, System.Int32 subtarget) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateScriptAssemblySettings (UnityEditor.BuildTarget buildTarget, System.Int32 subtarget, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, System.String[] extraScriptingDefines) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateScriptAssemblySettings (UnityEditor.BuildTarget buildTarget, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateEditorScriptAssemblySettings (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] unityAssembliesArg, System.Collections.Generic.Dictionary`2[TKey,TValue] precompiledAssembliesArg, System.String[] defines) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Compilation.CompilationPipeline.GetScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.IEditorCompilation editorCompilation, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, System.String[] extraScriptingDefines) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Compilation.CompilationPipeline.GetScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.IEditorCompilation editorCompilation, UnityEditor.Compilation.AssembliesType assembliesType, System.String[] extraScriptingDefines) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorCompilation editorCompilation, UnityEditor.Compilation.AssembliesType assembliesType, System.String[] extraScriptingDefines) (at <1acad9deef3549c4b9617dfa169c6659>:0)
UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Compilation.AssembliesType assembliesType) (at <1acad9deef3549c4b9617dfa169c6659>:0)
Unity.Burst.BurstCompiler.DomainReload () (at ./Library/PackageCache/com.unity.burst@f7a407abf4d5/Runtime/BurstCompiler.cs:560)
Unity.Burst.Editor.BurstLoader..cctor () (at ./Library/PackageCache/com.unity.burst@f7a407abf4d5/Runtime/Editor/BurstLoader.cs:216)
Rethrow as TypeInitializationException: The type initializer for 'Unity.Burst.Editor.BurstLoader' threw an exception.
Unity.Jobs.LowLevel.Unsafe.JobsUtility:ScheduleParallelFor_Injected(JobScheduleParameters&, Int32, Int32, JobHandle&)
Unity.Jobs.LowLevel.Unsafe.JobsUtility:ScheduleParallelFor(JobScheduleParameters&, Int32, Int32)
Unity.Jobs.IJobParallelForExtensions:Schedule(GenerateTextJobData, Int32, Int32, JobHandle)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Same here, even with the previous fix, I am still getting this error in Unity 6.2
There is a fork of this project 'github.com/RobProductions/StellarUnityBuild' that I've been using instead and doesn't have this problem