Skip to content

Instantly share code, notes, and snippets.

@mminer
Created May 16, 2011 20:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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