To flip an object horizontally using Animator State Chart and transitions, follow these steps:
- Create a new Unity 2D project.
- Import the provided image; that is, EnemyBug.png.
- Drag an instance of the red Enemy Bug image from the Project | Sprites folder into the scene. Position this GameObject at (0, 0, 0) and scale it to (2, 2, 2).
- With the Enemy Bug GameObject selected in the Hierarchy window, open the Animation window (Window | Animation | Animation) and click the Create button to create a new Animation Clip asset. Save the new Animation Clip asset as beetle-right. You will also see that an Animator component has been added to the Enemy Bug GameObject:
Figure 6.5 – Animator component added to the Enemy Bug GameObject
- If you look in the Project window, you'll see that two new asset files have been created: an Animation Clip called beetle-right and an Animator Controller named Enemy Bug:
Figure 6...