public static void Create() { #if UTOMATE_DEMO if (UTomate.CheckPlanCountExceeded()) { return; } #endif UTils.CreateAssetOfType <UTAutomationPlan> ("Automation Plan"); }
/// <summary> /// Requests to run a certain plan. Only one plan can run at a time. /// </summary> /// <param name='plan'> /// The plan to run. /// </param> /// <param name='context'> /// Context in which the plan should run. /// </param> public void RequestRun(UTAutomationPlan plan, UTContext context) { #if UTOMATE_DEMO // when developing utomate demo locally we want to allow our own plans, so we set another flag which // removes this restriction for us. #if !UTOMATE_DEVELOPMENT_MODE if (UTomate.CheckPlanCountExceeded()) { return; } #endif #endif if (IsRunning) { throw new InvalidOperationException("The runner is currently busy. Use IsRunning to check if the runner is busy, before invoking this."); } this.plan = plan; this.context = context; float expectedTimeInSeconds = 0; this.planWasRunBefore = UTStatistics.GetExpectedRuntime(plan, out expectedTimeInSeconds); this.expectedTime = TimeSpan.FromSeconds(expectedTimeInSeconds); UTPreferences.LastRunPlan = plan.name; planLookupDone = false; if (OnRunnerStarted != null) { OnRunnerStarted(); } // save all changes to assets before run. AssetDatabase.SaveAssets(); EditorApplication.SaveAssets(); // keep stuff running in background // this will overwrite playersettings implicitely, therefore we store the previous value here.. playerSettingsRunInBackgroundValue = PlayerSettings.runInBackground; Application.runInBackground = true; // and set it back here... so we don't f**k up the settings that were set before running utomate. PlayerSettings.runInBackground = playerSettingsRunInBackgroundValue; this.reloadOfAssembliesLocked = false; }