// The functions below act as entry points to this class and one of them // should be called so that everything is initialized properly. public static void ManualBuildQueue (int nextID = 0) { if (nextID == 0) { ResetBuild(); } HeadlessProfiles.FindProfiles (); queueID = nextID; int i = 0; bool found = false; foreach (KeyValuePair<string,string> profile in HeadlessProfiles.GetProfileList()) { if (i == nextID) { HeadlessProfiles.SetProfile (profile.Key); found = true; } i++; } if (found) { ManualBuild (true); } else { UnityEngine.Debug.Log ("Finished building all profiles!\nHeadless Builder (v" + Headless.version + ")"); } }
// This function overarches the entire build process private static void Build () { buildError = false; if (batchBuild) { // Process the relevant command line arguments string[] args = System.Environment.GetCommandLineArgs (); string batchPath = null; string batchProfile = null; for (int i = 0; i < args.Length - 1; i++) { if (args [i] == "-headlessPath") { batchPath = args [i + 1]; } if (args [i] == "-headlessProfile") { batchProfile = args [i + 1]; } } if (batchPath != null && Directory.Exists (batchPath)) { buildPath = batchPath; } else { UnityEngine.Debug.LogError ("Use the -headlessPath command line parameter to set a valid destination path for the headless build\nHeadless Builder (v" + Headless.version + ")"); return; } if (batchProfile != null) { bool found = false; HeadlessProfiles.FindProfiles (); foreach (KeyValuePair<string,string> profile in HeadlessProfiles.GetProfileList()) { if (profile.Value.Equals (batchProfile)) { found = true; HeadlessProfiles.SetProfile (profile.Key); } } if (!found) { UnityEngine.Debug.LogError ("The profile specified by the -headlessProfile command line parameter was not found\nHeadless Builder (v" + Headless.version + ")"); return; } } } if (manualBuild || debugBuild) { if (!EditorWindow.GetWindow<HeadlessEditor>().IsDocked()) { EditorWindow.GetWindow<HeadlessEditor>().Close(); } } // Load the settings (from file, not from memory) PrepareVariables(); Headless.SetBuildingHeadless (true, headlessSettings.profileName); bool asyncExecute = manualBuild || debugBuild; if (asyncExecute) { HeadlessRoutine.start (InnerBuildAsync ()); } else { InnerBuildSync (); } }