A simple Finite State Machine Implementation

Hello everyone,

Here’s a short tutorial I made demonstrating a way to create a finite state machine.

The power of my solution comes from the use of concurrency. Repeating methods that take more than one frame are started when your transition to a new state. Interruptions of tasks are dealt with by using Prime[31]'s coroutine manager (an excellent tool for any Unity developer I would say). This would be hard and ugly to implement in the Update (trust me I’ve tried!)

Transitions between states are dealt with using delegates and lambda functions to avoid code bloat.

Hope you like the tutorial. If you want the script let me know!

Cheers,

Tom

Hello Tom, just watched the video. It’s an interesting subject. I have subscribed and will peruse other videos at my leisure.

I use Prime31’s Job stuff too! It’s good stuff!

Thanks Andy, glad you found it interesting. If you’d like to look at the script just PM me.

I did PM you yesterday.