State machine patterns for Unity including hierarchical states, async transitions, and cleanup safety.