animancer
animancer copied to clipboard
Add BidingFlags.FlattenHeirarchy to AnimancerEditorUtilities.StaticBindings
Use Case
I have a case where some Event Names are used in some places while a superset is used elsewhere. I've set this up as:
public static class BaseEventNames {
public static string EventName1 = "EventName1";
};
public static class SpecializedEventNames : BaseEventNames {
public static string SpecialEventName1 = "SpecialEventName1";
}
public class AnimationHolder {
[EventNames(typeof(SpecializedEventNames ))] MyAnimationHolder specialAnimation;
[EventNames(typeof(BaseEventNames ))] MyAnimationHolder baseAnimation;
};
By default the editor will only see the SpecializedEventNames and not the inherited BaseEventNames in the EventNames dropdown.
Solution
Setting AnimancerEditorUtilities.StaticBindings as: StaticBindings = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy; shows the full set of event names.
Your solution seems to work, though StaticBindings is used in a few other places so I might end up putting FlattenHierarchy just in where it's used by the event names system. I'll need to look into it more closely.