public void StartNewProcess(string buildPath, QBProfile editorProfile, QBPlayerSettings playerSettings, int numProcess = 1) { for (int processIndex = 0; processIndex < numProcess; ++processIndex) { StartNewSoloProcess(buildPath, editorProfile, playerSettings, processIndex); } }
void StartNewSoloProcess(string BuildPath, QBProfile editorSettings, QBPlayerSettings PlayerSettings, int ProcessID) { QBProcess process = new QBProcess(BuildPath, editorSettings, PlayerSettings, ProcessID); process.OnProcessCompleted += HandleProcessCompleted;; _processes.Add(process); process.Start(); }
public QBProcess(string buildPath, QBProfile editorProfile, QBPlayerSettings playerSettings, int instanceID) { _instanceID = instanceID; _profile = editorProfile; _processStartInfo = new ProcessStartInfo(); //_processStartInfo.UseShellExecute = false; _processStartInfo.WindowStyle = ProcessWindowStyle.Normal; // processStartInfo.RedirectStandardOutput = EditorSettings.RedirectOutputLog; _processStartInfo.FileName = buildPath; _processStartInfo.Arguments = BuildCommandLineArguments(editorProfile, playerSettings, instanceID); UnityEngine.Debug.Log("Command line arguments : " + _processStartInfo.Arguments); }
QBPlayerSettings GeneratePlayerSettings() { QBPlayerSettings qbPlayerSettings = new QBPlayerSettings(); qbPlayerSettings.AdditiveScenes = new string[SceneManager.sceneCount - 1]; int sceneIndex = 0; for (int i = 0; i < SceneManager.sceneCount; ++i) { Scene currentScene = SceneManager.GetSceneAt(i); // Add only additives! if (currentScene != SceneManager.GetActiveScene()) { qbPlayerSettings.AdditiveScenes[sceneIndex++] = SceneManager.GetSceneAt(i).name; } } return(qbPlayerSettings); }
private string BuildCommandLineArguments(QBProfile editorProfile, QBPlayerSettings playerSettings, int instanceID) { StringBuilder sb = new StringBuilder(); AddCommandLineArgument(sb, QBCommandLineParameters.EnableQuickBuild); AddCommandLineArgument(sb, QBCommandLineParameters.InstanceID, instanceID); AddCommandLineArgument(sb, QBCommandLineParameters.Screen_FullscreenMode, editorProfile.advancedSettings.screenSettings.isFullScreen ? 1 : 0); int width, height; editorProfile.GetScreenSizeForInstance(instanceID, out width, out height); AddCommandLineArgument(sb, QBCommandLineParameters.Screen_Width, width); AddCommandLineArgument(sb, QBCommandLineParameters.Screen_Height, height); string outputLogFileName = string.Empty; if (!editorProfile.advancedSettings.redirectOutputLog) { outputLogFileName = editorProfile.BuildDirectoryPath + "/" + string.Format(QBCommandLineParameters.LogFileFormat, instanceID); AddCommandLineArgument(sb, QBCommandLineParameters.LogFile, outputLogFileName); } else { AddCommandLineArgument(sb, QBCommandLineParameters.RedirectOutput); } if (editorProfile.expertSettings.launchInBatchMode) { AddCommandLineArgument(sb, QBCommandLineParameters.Batchmode); AddCommandLineArgument(sb, QBCommandLineParameters.NoGraphics); } if (editorProfile.advancedSettings.displayInstanceID) { AddCommandLineArgument(sb, QBCommandLineParameters.DisplayInstanceID); } if (playerSettings.AdditiveScenes.Length > 0) { AddCommandLineArgument(sb, QBCommandLineParameters.AdditiveScenes, QBCommandLineHelper.PackStringArray(playerSettings.AdditiveScenes)); } if (instanceID < editorProfile.expertSettings.customInstanceDatas.Length) { QBInstanceData qbInstanceData = editorProfile.expertSettings.customInstanceDatas[instanceID]; if (qbInstanceData) { AddCommandLineArgument(sb, qbInstanceData.commandLineArguments); if (!string.IsNullOrEmpty(qbInstanceData.customName)) { AddCommandLineArgument(sb, QBCommandLineParameters.CustomName, qbInstanceData.customName); } } } AddCommandLineArgument(sb, editorProfile.advancedSettings.commandLineArguments); return(sb.ToString()); }