/// <summary> /// A helper method that draws a button at the given region. /// </summary> private void EditButton(ref Rect region, object element, InspectedMethod method) { Rect buttonRect = region; buttonRect.height = ButtonHeight; GUIContent buttonLabel = method.DisplayLabel; // Disable the button if invoking it will cause an exception if (method.HasArguments) { buttonLabel = new GUIContent(buttonLabel); buttonLabel.text += " (Remove method parameters to enable this button)"; } EditorGUI.BeginDisabledGroup(method.HasArguments); if (GUI.Button(buttonRect, buttonLabel)) { method.Invoke(element); GUI.changed = true; // anything could have happened } EditorGUI.EndDisabledGroup(); region.y += ButtonHeight; }
public bool IsInterested(InspectedMethod method) { return method.Method.IsDefined(typeof(InspectorButtonAttribute), /*inherit:*/ true); }
public bool IsInterested(InspectedMethod method) { return false; }