Any State

Any State allows us to set a condition where we force an animation to play overtop any other action going on. Basically, it will take any animation or “state” the player happens to be in and then interrupt it with a new action or animation.

A good case for this would be if you needed to play a looping animation, but if a condition was met, you could play an animation overtop of the looping one. Playing a damage animation would be a good example, but we will be adding this through code instead.

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation 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.