Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mminer
Created May 16, 2011 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mminer/975335 to your computer and use it in GitHub Desktop.
Save mminer/975335 to your computer and use it in GitHub Desktop.
Unity editor script to invoke undocumented MacroEvaluator class.
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