Create a Finite State Machine in Unity 3D using Zenject

One useful design pattern in game development is the State design pattern. It can be used in various occasions from player input to enemy AI.

We can manage all the states using a Finite State Machine. With a FSM we have distinct finite states that we can transition to, but having only one state enabled at any given time.

In our example we will implement a Game Manager, that controls our game states in Unity, using Zenject framework. Zenject is Dependency Injection Framework for Unity 3D.

Continue reading