Skip to content

Commit ada1021

Browse files
committed
Fix disabling invoke button when invoke cannot be called
- Follow up fix for bug exposed by Lyuma's fix null pointer exception on the EventTrigger component where the invoke button was supposed to be disabled, but wasn't because the button draw was happening outside the disabled group.
1 parent 2b89d98 commit ada1021

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

EasyEventEditor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,16 +810,16 @@ void DrawInvokeField(Rect position, float headerStartOffset)
810810
GUIStyle textStyle = EditorStyles.miniLabel;
811811
textStyle.alignment = TextAnchor.MiddleLeft;
812812

813-
bool executeInvoke = GUI.Button(buttonPos, "", EditorStyles.miniButton);
814-
GUI.Label(textPos, "Invoke"/* + " (" + string.Join(", ", eventInvokeArgs.Select(e => e.Name).ToArray()) + ")"*/, textStyle);
815-
816813
MethodInfo invokeMethod = InvokeFindMethod("Invoke", dummyEvent, dummyEvent, PersistentListenerMode.EventDefined);
817814
FieldInfo serializedField = currentProperty.serializedObject.targetObject.GetType().GetField(currentProperty.name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
818815

819816
object[] invokeTargets = currentProperty.serializedObject.targetObjects.Select(target => target == null || serializedField == null ? null : serializedField.GetValue(target)).Where(f => f != null).ToArray();
820817

821818
EditorGUI.BeginDisabledGroup(invokeTargets.Length == 0 || invokeMethod == null);
822819

820+
bool executeInvoke = GUI.Button(buttonPos, "", EditorStyles.miniButton);
821+
GUI.Label(textPos, "Invoke"/* + " (" + string.Join(", ", eventInvokeArgs.Select(e => e.Name).ToArray()) + ")"*/, textStyle);
822+
823823
if (eventInvokeArgs.Length > 0)
824824
{
825825
System.Type argType = eventInvokeArgs[0];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.merlin.easyeventeditor",
33
"displayName": "Easy Event Editor",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"unity": "2017.4",
66
"description": "Drop in replacement for the default Unity event editor drawer that allows listener reordering and a few other things",
77
"keywords": ["Event", "Editor", "Delegate"],

0 commit comments

Comments
 (0)