/************************************************************************************************************************/ /// <summary> /// Adds a menu item that will call <see cref="GatherSubProperties"/> then run the specified /// `function`. /// </summary> protected void AddPropertyModifierFunction(GenericMenu menu, string label, MenuFunctionState state, Action <SerializedProperty> function) { Serialization.AddPropertyModifierFunction(menu, CurrentProperty, label, state, (property) => { GatherSubProperties(property); function(property); }); }
/************************************************************************************************************************/ /// <summary> /// Adds a menu item to execute the specified `function` for each of the `property`s target objects. /// </summary> public static void AddPropertyModifierFunction(GenericMenu menu, SerializedProperty property, string label, MenuFunctionState state, Action <SerializedProperty> function) { if (state != MenuFunctionState.Disabled) { menu.AddItem(new GUIContent(label), state == MenuFunctionState.Selected, () => { ForEachTarget(property, function); }); } else { menu.AddDisabledItem(new GUIContent(label)); } }