Editor/BuilderHelper.cs
/// <summary>
/// Switches build group and the build target.
/// </summary>
/// <returns>Report of the process</returns>
Switches build group and the build target.
Switches build group and the build target .
public static string SwitchBuildTarget(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            StringBuilder report = new StringBuilder($"---Switching build target to {buildTarget}\n");
            bool switched = EditorUserBuildSettings.SwitchActiveBuildTarget(buildTargetGroup, buildTarget);
            stopwatch.Stop();
            report.Append($"---Build target {(switched ? "switched" : "failed to switch")} " +
                          $"at {DateTime.Now.ToString()} in {stopwatch.ElapsedMilliseconds / 1000}s");
            if (!switched)
            {
                Debug.LogError($"Couldn't switch back to the original build target '{buildTarget}'");
            }
            return report.ToString();
        }
public static string SwitchBuildTarget ( BuildTargetGroup buildTargetGroup , BuildTarget buildTarget ) { Stopwatch stopwatch = new Stopwatch ( ) ; stopwatch . Start ( ) ; StringBuilder report = new StringBuilder ( $" ---Switching build target to  { buildTarget } \n " ) ; bool switched = EditorUserBuildSettings . SwitchActiveBuildTarget ( buildTargetGroup , buildTarget ) ; stopwatch . Stop ( ) ; report . Append ( $" ---Build target  { ( switched ? " " : " " ) } " + $" at  { DateTime . Now . ToString ( ) }  in  { stopwatch . ElapsedMilliseconds / 1000 } s " ) ; if ( ! switched ) { Debug . LogError ( $" Couldn't switch back to the original build target ' { buildTarget } ' " ) ; } return report . ToString ( ) ; }
Switches build group and the build target.
Switches build group and the build target .
Report of the process
Report of the process
buildTargetGroup
BuildTargetGroup
buildTarget
BuildTarget