I want to get events from UI elements when they are hovered over, pressed, disabled (directly or indirectly due to CanvasGroups), etc…
I could inherit from Selectable, but then I’d either:
a) inherit directly from Selectable, preventing the use of existing functionality from Scrollbar, Button, Toggle, etc., or
b) inherit from the derived Selectable classes, which means my custom class would have to be duplicated to inherit from each one.
The only other option I see is to make a new component that inherits from UIBehaviour (in order to get OnCanvasGroupChange calls), and that implements IPointerDownHandler, IPointerExitHandler, etc., then calculates its state, and raises events when that state changes… which is basically exactly what Selectable does, so it’s a shame to not use that existing functionality.
I think that Selectable should make its currentSelectionState property public, and should have public events for when currentSelectionState changes. It’s not like this information is being hidden: you can currently access the state by attaching an Animator component, hooking it up to the Selectable through the animation trigger transition type, then have the Animator animate a value representing the Selectable’s state, or have it use Animation Events. But that’s ridiculous.
As for my use case, I’m trying to make reusable animations for UI elements: colour change, transform scale change, fade, etc… You can’t make reusable animations with Mecanim if the users of the animation have different hierarchy structures (a scrollbar might be set up differently than a button, tab, or checkbox) - nevermind that Mecanim is complete overkill for small animations like fading a button. So I arrived at this problem when trying to send interaction events to a scripted animation system.
I don’t think that is a very specific case - anyone making at least a medium-sized UI system with any form of visual effects would want reusable animations for UI elements.