bazyleu / UniState

UniState is a code architecture framework for Unity, designed around State pattern. Offers high performance and excellent scalability, ideal for complex Unity projects.
MIT License
91 stars 4 forks source link

Add GoBackTo state transition #68

Open JakBlack opened 2 weeks ago

JakBlack commented 2 weeks ago

Right now, it's hard to separate long flows into states because there's no way to return to core state via history It's possible to launch these long flows in one state and separate flow into states with separate state machine, but that adds extra comlexity

Add GoBackTo transition, which will find specified state in state history and go back to it, clearing any intermediate state from history Need to come up with error handling in case specified state isn't found in state history, proposed solution - log an exception, exit the state machine

bazyleu commented 2 weeks ago

Thanks for your suggestion! It is a good idea to add a "GoBackTo" transition to handle long flows easier. If the specified state is not in history, I think it is better to exit the state machine because it is more consistent with classic "GoBack" behavior . We will implement this in future versions.