GetEvent() public static method

public static GetEvent ( Component component, UnityEditor.SerializedProperty eventProperty ) : UnityEventBase
component Component
eventProperty UnityEditor.SerializedProperty
return UnityEventBase
    static void FigureViewBinding(CommandBinding binding)
    {
        var sobj   = new SerializedObject(binding);
        var vcprop = sobj.FindProperty("_view");
        var veprop = sobj.FindProperty("_viewEvent");

        if (string.IsNullOrEmpty(veprop.stringValue))
        {
            return;
        }

        var vcomp = vcprop.objectReferenceValue as Component;

        if (vcomp == null)
        {
            return;
        }

        var @event = INPCBindingEditor.GetEvent(vcomp, veprop);

        if (@event != null)
        {
            UnityEditor.Events.UnityEventTools.AddVoidPersistentListener(@event, binding.ExecuteCommand);
        }

        sobj.ApplyModifiedProperties();
    }
    static void FigureViewBinding(CommandBinding binding)
    {
        var sobj   = new SerializedObject(binding);
        var vcprop = sobj.FindProperty("_view");
        var veprop = sobj.FindProperty("_viewEvent");

        if (string.IsNullOrEmpty(veprop.stringValue))
        {
            return;
        }

        var vcomp = vcprop.objectReferenceValue as Component;

        if (vcomp == null)
        {
            return;
        }

        var @event = INPCBindingEditor.GetEvent(vcomp, veprop);

        if (@event != null)
        {
            // Fixing adding multiple command binding event handlers when using prefabs
            var eventCount = @event.GetPersistentEventCount();
            for (var idx = 0; idx < eventCount; idx++)
            {
                var perTarget = @event.GetPersistentTarget(idx);
                // if we find a duplicate event skip over adding it
                if (perTarget == binding)
                {
                    return;
                }
            }

            UnityEditor.Events.UnityEventTools.AddVoidPersistentListener(@event, binding.ExecuteCommand);
        }

        sobj.ApplyModifiedProperties();
    }