How to Make a State Machine for Enemy AI | AI Series Part 11




Published: 20 Apr 2021

In this tutorial I go over how to implement a basic state machine to control the AI Behavior. Instead of just always following the player, the Agents can now be configured to idly walk around, patrol random sets of points on the NavMesh, or chase the player if they have line of sight. On top of all of that! All these will be configurable in our EnemyScriptableObject so the states can be easily customized per Agent.

As usual with the AI Series, we're using the NavMesh Components: https://docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.


🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂

👨‍💻 Get the FULL FREE PROJECT on GitHub: https://github.com/llamacademy/ai-series-part-11

🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly


Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.