- Home /
Unity 5 GUI system
Using the new GUI interface, I have a Button at the edge of my screen. When clicked, I want it to animate towards the middle of the screen to reveal a sidebar.
So I set the Transition on the Button to 'Animation' and click 'Auto Generate Animation'. In the Animation window I do the necessary animations I need within the 'Pressed' section.
When I test it, the button will animate out and reveal the sidebar, but as soon as I release the button, it snaps back to the original position.
I know this is because it is the 'Pressed' state, but there is no option for a 'Clicked' state.
Does anyone know how to press a button, have it play an animation and stop there without it snapping back?
Ive had a look at the video found here: http://unity3d.com/learn/tutorials/modules/beginner/ui/ui-button which was helpful to start me off but theres not much more documentation that I could find on Button functionality for the new GUI.
Answer by ZeLemon · May 27, 2015 at 06:47 PM
Maybe use toggle since what you want is a button that has both off and clicked (on) states
Is there any documentation you could link me to on how to do this? I've been trying to find out how to do toggle buttons for a while. Thanks
Not really sorry apart from the unity manual (http://docs.unity3d.com/460/Documentation/$$anonymous$$anual/script-Toggle.html) I have mostly gone throught trials and error for my specific usage