Currently were given a callback of OnInit() within FSMState which allows us to define behavior which will occur “When the FSM itself starts”. Could we not also be given a callback of OnFinish() within FSMState which will be called when the FSM finishes?
Currently the way to do this is a bit odd (see below) and I think adding a callback to the FSMState makes quite a bit more sense.
Example of handling FSM onFinish event currently from within FSMState.
1
2
3
4
5
6
7
protectedoverridevoidOnEnter(){
graph.onFinish()=>{
//finish code here
}
}
Thanks in advance! Really appreciate the support from the asset.
P.S. Maybe the OnFinish event could also pass along a bool like so OnFinish(bool isRootFinish) so we know if the finish is coming from the root FSM or a nestedFSM.
Thanks for letting me know about OnInit. It was actually an error on the documentation/description (fixed).
Regarding a callback when the FSM starts and when the FSM finishes respectively, I have just made a few minor changes for that. You can simply remove the ‘seal’ in the ‘OnGraphStarted’ and ‘OnGraphStopped’ methods in the FSM.cs class and thus use them for your own purposes in your custom derived FSM state nodes.
Please let me know if this change works for you.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.