I’m looking at this atm, but cannot seem to find a solution so far.
What I want is to call a animation trigger between animations A and B.
So click once, the transition trigger is set and animation B is played. Click again and trigger sets animation back to A. This works manually when running the game window.
I found something working for a mousebutton click to run anim.SetTrigger(“Triggername”), but cannot seem to find any examples how to set this up for a UI menu button.
Found lots of UI trigger examples, and some mentioning of Events, but nothing directly on a menu button.
If you have already found a solution that works with mouse buttons, you should be able to apply the same to menu buttons. It’s just a different way of associating the logic with the input control.
With mouse buttons, you’ve probably polled the button state via Unity’s standard input in Update. With Unity’s UI system (not the legacy UI though), you’d add a listener to the onClick event.
A bit of a late reply, but Suddoha’s reply got me in the right direction in the end.
I thought I found a way to do some it without code, by dragging the object/hierarchy onto the button’s onClick event, and selecting the Gameobject:SetActive(bool) function.
Unfortunately this doesn’t really do a boolean on/off switch., but it is a quick way to do simple stuff straight from the Inspector.