# thefuntastic/Unity3d-Finite-State-Machine

An intuitive Unity3d finite state machine (FSM).  Designed with an emphasis on usability, without sacrificing utility.

Repository: https://github.com/thefuntastic/Unity3d-Finite-State-Machine
Canonical: https://ross.abutalabs.com/products/unity3d-finite-state-machine
Language: C#
License: MIT
License Family: permissive
Last push: 2021-09-28T10:43:20+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 5266, "days_push": 1800, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1691, forks 237 (observed 2026-08-28T04:05:22.603462+00:00)

## What it is
A lightweight, intuitive finite state machine (FSM) library for Unity written in C#. It lets developers define states as enums and implement state behavior via underscore-convention methods inside MonoBehaviours, with reflection-based wiring and zero garbage allocation after initialization.

## Use cases
- manage game state like game over, restart, and continue in Unity
- implement NPC and enemy AI behaviour states
- handle UI button states such as hover and press
- drive animation state transitions for game actors
- replace boilerplate-heavy C# state machine implementations with a simple enum-driven API
- build state machines that work on iOS, Android, and IL2CPP builds

## When to choose
- you are building a Unity game and need a simple, low-overhead FSM
- you want state logic colocated inside your MonoBehaviour with minimal boilerplate
- you need a battle-tested library that ships in production and supports mobile/IL2CPP
- you prefer convention-based state methods over verbose configuration

## When to avoid
- you need a general-purpose C# state machine outside of Unity
- you require hierarchical or pushdown state machines with advanced transition graphs
- you need hierarchical state machines or async/await-driven state flows
- your project no longer targets Unity 2019.4-era APIs and the unmaintained library breaks

## Facets
- artifact type: library
- maturity: maintenance
- function: game-engine, concurrency, developer-tools
- domain: gaming-tools, cross-platform
- platform: game-engine, cross-platform
- tags: unity, finite-state-machine, fsm, csharp, monobehaviour, game-ai, state-management, game-development, mobile, desktop

## Member repositories
- thefuntastic/Unity3d-Finite-State-Machine (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:22.603462+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:38:17.059768+00:00, confidence not recorded.
  - readme: https://github.com/thefuntastic/Unity3d-Finite-State-Machine (fetched 2026-08-28T04:05:22.603462+00:00, sha 85730903a560)
- Data as of 2026-08-30T08:39:29.467469+00:00.
