Unity editor script to invoke undocumented MacroEvaluator class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEditor.Macros; | |
using UnityEngine; | |
/// <summary> | |
/// Allows use of the undocumented MacroEvaluator class. Use at your own risk. | |
/// </summary> | |
public class Macros : EditorWindow | |
{ | |
string macro = ""; | |
/// <summary> | |
/// Adds a menu named "Macros" to the Window menu. | |
/// </summary> | |
[MenuItem ("Window/Macros")] | |
static void Init () | |
{ | |
CreateInstance<Macros>().ShowUtility(); | |
} | |
void OnGUI () | |
{ | |
macro = EditorGUILayout.TextArea(macro, GUILayout.ExpandHeight(true)); | |
if (GUILayout.Button("Execute")) { | |
MacroEvaluator.Eval(macro); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment