How to create a simple behaviour tree in Unity/C#
Let’s see how to implement a basic behaviour tree to make a simple guard AI!
🚀 Find all of my Unity tutorials on Github!
This tutorial is available either in video format or in text format — see below :)
Get the scripts and assets for this tutorial on my Github :)
Wait — what about FSMs?
In a previous tutorial, I talked about finite state machines — aka FSMs — and I discussed how this pattern can help you implement well-organised and well-structured behaviour system, as long as this behaviour isn’t too complex.
In a follow-up episode, we saw how hierarchical finite state machines can mitigate some of the downsides of the FSMs by introducing inheritance and higher-order abstract states.
But the fact is that, when you try and model a more complex behaviour, FSMs will eventually come short. Chances are that, if you work on a really advanced AI system, or just on a player system that…