O'Reilly logo

Mastering Unity Scripting by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Finite State Machines in Mecanim

From this point onwards, we'll concentrate mainly on coding AI for the enemy character both in C# and in terms of visual coding for a Mecanim graph. Mecanim refers to the Unity's Animation System (http://docs.unity3d.com/Manual/MecanimAnimationSystem.html). In the upcoming sections, we'll piece together a complete class that looks at and discusses specific sections of code, and the full class source code will be pieced together as we go along. It can be viewed in the completed project in the AI_Enemy.cs file.

To start, let's examine FSMs conceptually. When thinking about the enemy character, we can observe in them a specific set of behaviors. The enemy begins the scene by standing idle and then proceeds to wander ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required