public static void CreateEcosystemPlan() { // get the folder selection // create a new plan at the currently selected folder. UTAutomationPlan plan = UTils.CreateAssetOfType <UTAutomationPlan>("name"); // create a new instance of the new class we created above. var editorModel = new PlayMakerEcosystem_uTomateModel(); editorModel.LoadPlan(plan); Selection.activeInstanceID = plan.GetInstanceID(); // now you can create actions. // FIRST ACTION UTEchoAction echoAction = UTAction.Create <UTEchoAction>(); // set their properties echoAction.text.Value = "Hello World"; echoAction.text.UseExpression = false; // this toggles f(x) // add the action to the automation plan var echoActionEntry = editorModel.AddAction(echoAction); echoActionEntry.name = "wtf"; Selection.activeInstanceID = plan.GetInstanceID(); // SECOND ACTION UTEchoAction anotherAction = UTAction.Create <UTEchoAction>(); // set their properties anotherAction.text.Value = "double dva"; anotherAction.text.UseExpression = false; // this toggles f(x) // add it as well var anotherActionEntry = editorModel.AddAction(anotherAction); //CONNECT // now connect the first echo action to the other action using the Connect method we wrote editorModel.Connect(echoActionEntry, anotherActionEntry); // finally set the echo action as first action var echoActionNode = editorModel.Graph.GetNodeFor(echoActionEntry); editorModel.SetFirstNode(echoActionNode); // if you want you can beautify the graph // so not all nodes are located at (0,0) editorModel.RelayoutPlan(); // finally you can execute your plan using UTomate.Run(plan); }
private void RunSelected() { ShowTab(); var selectedItems = listData.GetSelectedItems <UTAutomationPlan> (showHidden ? plans : visiblePlans); if (selectedItems.Count == 1) { UTomate.Run(selectedItems [0]); } RefreshInternals(); // build might change something, so better re-acquire all. }
public override void OnInspectorGUI() { DrawDefaultInspector(); EditorGUILayout.Space(); EditorGUILayout.HelpBox("You can directly run this plan from here.", MessageType.None); EditorGUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Run this plan")) { UTomate.Run(target as UTAutomationPlan); } EditorGUILayout.EndHorizontal(); }
private void DrawRunner() { GUILayout.Label("Runner", UTEditorResources.TitleStyle); var lastPlan = UTomateRunner.Instance.LastPlan; if (lastPlan != null && !UTomateRunner.Instance.IsRunning) { Rect boxRect = EditorGUILayout.BeginHorizontal(UTEditorResources.RunAgainBoxStyle); EditorGUI.HelpBox(boxRect, "Last executed plan: " + lastPlan.name, MessageType.None); GUILayout.FlexibleSpace(); if (GUILayout.Button(UTEditorResources.RunAgainIcon, UTEditorResources.RunAgainButtonStyle)) { UTomate.Run(lastPlan); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); UTomateRunner.Instance.DrawGUI(); if (!UTomateRunner.Instance.IsRunning) { EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUI.enabled = UTStatistics.HasStatistics(); if (GUILayout.Button("Clear plan statistics")) { UTStatistics.Clear(); } GUI.enabled = true; GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } else { Repaint(); } }
public static void RunPlan() { var plan = GetArg("-plan"); if (plan == null) { throw new ArgumentException("You need to specify a -plan argument."); } UTAutomationPlan thePlan = UTomate.UTAutomationPlanByName(plan); if (thePlan == null) { throw new ArgumentException("There is no plan named '" + plan + "'"); } var props = GetArgs("-prop"); var realProps = ParseProps(props); var debugMode = GetArg("-debugMode"); if (debugMode == "true") { UTPreferences.DebugMode = true; } else { UTPreferences.DebugMode = false; } UTomateRunner.Instance.OnRunnerFinished += delegate(bool cancelled, bool failed) { EditorApplication.Exit(cancelled || failed ? 1 : 0); }; UTomate.Run(thePlan, realProps); }
public void Execute() { UTomate.Run(this); }