Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: OnActiveStateChanged event? #22

Closed
santutu opened this issue May 14, 2023 · 4 comments
Closed

feature request: OnActiveStateChanged event? #22

santutu opened this issue May 14, 2023 · 4 comments

Comments

@santutu
Copy link
Contributor

santutu commented May 14, 2023

I suggest to add an Active StateChanged event to StateMachine class to track the state.
I took a quick look at the code, and I think it would be possible by invoking the event at StateMachine's ChangeState method. if this function is ok, I am willing to do pull request.

simple example
fsm.OnActiveStateChanged += (activeState)=> Debug.Log(activeState);

@Monsoonexe
Copy link

Monsoonexe commented May 14, 2023 via email

@Inspiaaa
Copy link
Owner

Hi @santutu,
Thanks for the feature request and the implementation of it in your pull request! I especially appreciate that you added unit tests. Thanks a lot!

I have merged your PR and made a few small changes. It will be released with the upcoming 2.1 version.

As I have not encountered a real-world use case for this feature myself, I'll be rolling out this feature conservatively, starting with a minimal version and seeing how well it fares. Future versions may then include enhancements, once I know more about how this feature is used.

@woodward54
Copy link

+1, this feature would also be useful for my project

@Inspiaaa
Copy link
Owner

The "state changed" event is now available in the latest release (2.1) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants