How to do it...

To create an animated button, follow these steps:

  1. (Optional) Import the Button graphic to Unity.
  2. Open a scene and create a new Button by using the Game Object | UI | Button command. Canvas and Button game objects will be created.
  3. Select the Button game object and find the Button component in Inspector.
  4. Set the Transition to Animation.
  1. Click on the Auto Generate Animation button, as shown in the following screenshot:
  1. Four empty Animation Clips will be created, one for each button state.
  2. With the button selected, open the Animation View.
  3. Select each animation in the Animation View (their names correspond with button states) and change the appearance of the Button game object with the record button pressed in the Animation View. You can change the size of the button, its color, text, and so on. Even one frame of the animation is enough for creating a smooth transition because Unity will smoothly transition between those animations when the game changes the Button state.
  4. When you finish your animations, close the Animation View and play the game to see the effect.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.247.81