Skip to content

Instantly share code, notes, and snippets.

@mminer mminer/Macros.cs
Created May 16, 2011

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
You can’t perform that action at this time.