- Home /
ArgumentException: targetGroup must be valid
I'm trying to create builds with BuildPlayer using something similar to BuildPlayerPipeline example but from a shell script in an attempt to use Continuous Integration but I keep getting the following error using Version 2017.1.1:
ArgumentException: targetGroup must be valid
at UnityEditor.Modules.ModuleManager.GetTargetStringFrom (BuildTargetGroup targetGroup, BuildTarget target) [0x0000c] in /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/ModuleManager.cs:744
at UnityEditor.Modules.ModuleManager.GetBuildPostProcessor (BuildTargetGroup targetGroup, BuildTarget target) [0x00003] in /Users/builduser/buildslave/unity/build/Editor/Mono/Modules/ModuleManager.cs:523
at UnityEditor.PostprocessBuildPlayer.PrepareForBuild (BuildOptions options, BuildTargetGroup targetGroup, BuildTarget target) [0x00003] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:84
I tried invoking the script with something like this: -buildTarget StandaloneLinuxUniversal -buildTargetGroup Standalone but I can't figure this out.
I managed to see where this error comes from in decompiled unity UnityEditor/UnityEditor.Modules/ModuleManager.cs#L1030
Answer by GabLeRoux · Sep 29, 2017 at 05:14 PM
So it turned out that after updating to Unity3d 2017.1.1, they deprecated the signature of BuildPlayer, but it actually fails with the error from description. So the solution is to use the new signature from BuildPlayer 2017.1.1 documentation which takes a BuildPlayerOptions object as its only parameter. Then you can specify a targetGroup into this object and things will work. :)
This code can be used to spot problems with a BuildPlayerOptions buildPlayerOptions; :
Console.WriteLine ("locationPathName: " + buildPlayerOptions.locationPathName);
Console.WriteLine ("target: " + buildPlayerOptions.target);
Console.WriteLine ("targetGroup: " + buildPlayerOptions.targetGroup);
Console.WriteLine ("scenes: " + buildPlayerOptions.scenes);
Console.WriteLine ("assetBundleManifestPath: " + buildPlayerOptions.assetBundleManifestPath);
Your answer
Follow this Question
Related Questions
Command line flag to build WebGL 3 Answers
xr plugin managment arkit required script 0 Answers
Distribute terrain in zones 3 Answers
Command-line build 64-bit 1 Answer
[Closed]How to Build and Deploy to the Android device from the script 1 Answer