Is there a way to listen to UI Selectable state change programatically?
I know that I can do it in design time by setting up an Event Trigger component but I am looking to something like a OnStateChanged method or event on the GameObject or on the component that implements Selectable.
I have a button that when pressed, the label must be translated 4 pixels down and when released the label must translate back to the original position. I’ve attached an EventTrigger component to that button that calls a methods on a custom script that do this translations on PointerDown and PointerUp events. That solves the question for when I click the button with the pointer but when I activate the button with the keyboard keys, there are no events to catch in order to translate the label. If I could handle the state change event, this would be solved for whatever input method I choose to activate the button, right?
Hm! That’s a good solution but I will loose the SpriteSwap transition that I need as well. Is there a way to create animations AND sprite swapping in transitions?