How to do it...

To flip an object horizontally using Animator State Chart and Transitions, follow these steps:

  1. Create a new Unity 2D project.
  2. Import the provided image: EnemyBug.png.
  3. 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 to (2, 2, 2).
  1. With the Enemy Bug GameObject selected in Hierarchy, open the Animation panel (menu: 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:
  1. If you look at the Project panel, you'll see two new asset files have been created: ...

Get Unity 2018 Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.