Add OnFinish to FSMState

NodeCanvas Forums General Discussion Add OnFinish to FSMState

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13901
    meatloaf
    Participant

    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.

    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.

    #13902
    meatloaf
    Participant

    After some investigation it looks like this bit in the documentation is incorrect

    That callback actually fires when the state initializes not the actual FSM :(.

    #13908
    personuo
    Participant

    Super Action State?

    Attachments:
    You must be logged in to view attached files.
    #13918
    Gavalakis
    Keymaster

    Hey,

    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

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.