void AddParameterMenu()
{
List<GUIContent> ParamMenu = new List<GUIContent>();
Dictionary<string, System.Type> ParamTypes = new Dictionary<string, System.Type>();
// Get a list of classes that derive from MBParameter
Assembly asm = Assembly.GetAssembly(typeof(MBParameter));
System.Type[] types = asm.GetTypes();
foreach (System.Type T in types) {
if (T.IsSubclassOf(typeof(MBParameter))) {
// Get MBParameterInfo-Attribute
System.Attribute info = System.Attribute.GetCustomAttribute(T, typeof(MBParameterInfo));
if (info != null) {
// Add Menu entry
ParamMenu.Add(new GUIContent(((MBParameterInfo)info).Menu));
// Link Menu entry to class (for OnAddParameterMenu)
ParamTypes.Add(((MBParameterInfo)info).Menu, T);
}
}
}
EditorUtility.DisplayCustomMenu(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 100, 100),
ParamMenu.ToArray(), -1, OnAddParameterMenu,ParamTypes);
}