public static bool PollTriggers(this ITriggereableRebinder poller, List <IRebindingTrigger> triggers) { var serializedObject = poller.serializedObject; // This could run after deleting an object, specially if deletion is behind a menu or a dialog that pauses the editor, // so we check that the targetObject stil exists. if (!serializedObject.targetObject) { return(false); } serializedObject.Update(); bool rebindRequested = false; // We go in reverse in case a trigger decides to be removed in PollForChanges. Although, is there // a good reason for that to happen? Are we reinforcing risky behavior by supporting this? for (int i = triggers.Count - 1; i >= 0; i--) { if (triggers[i] != null && triggers[i].PollForRebinding()) { rebindRequested = true; } } return(rebindRequested); }
bool IRebindingTrigger.IsCompatibleWithRebinder(ITriggereableRebinder rebinder) { return(rebinder.serializedObject == serializedProperty.serializedObject); }