void DrawButton() { Type type = target.GetType(); MethodInfo[] ms = type.GetMethods(); foreach (var item in ms) { InspectorPlus.Button att_button = ReflecTool.GetAttribute <InspectorPlus.Button>(item); if (att_button != null) { if (att_button.Playing && Application.isPlaying) { } else if (att_button.Editor && !Application.isPlaying) { } else { OnGUIUtility.Vision.GUIEnabled(false); } Button(item, att_button); OnGUIUtility.Vision.GUIEnabled(true); } } }
protected void Button(MethodInfo item, InspectorPlus.Button att_button) { EditorGUILayout.BeginHorizontal(); { GUILayout.Label(new GUIContent(att_button.Title, att_button.Help)); if (GUILayout.Button(item.Name)) { foreach (var tgt in targets) { if (tgt.GetType() == target.GetType()) { item.Invoke(target, null); } } } } EditorGUILayout.EndHorizontal(); }