EndAction in ActionTask.cs

NodeCanvas Forums Support EndAction in ActionTask.cs

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13565
    w
    Participant

    Hi there,

    Back again another question about ActionTask. I noticed that when a branch is interrupted or reset, OnReset is invoked on the ActionNode of that branch, which in turn calls action.EndAction(null) on the task, as shown in the following code, EndAction(null) sets the status of the task to Failure.

    This is mostly fine but in our game, we implemented some interruptable idle behavior which plays some cycle animation and audio on a character when the player is not interacting. When the player interacts, idle behavior gets interrupted and we branch to some other logic. We want to go back to idle once the branched behavior finishes. However since the status is set to failure when interrupted, it won’t resume/restart when we get back to the idle behavior again.

    However, the solution seems easy, if I uncomment this line in ActionTask,

    This will set the task status to Resting instead of Failure upon Reset, making it possible to re-run the task after interruption.

    My question is, does this introduce any side effects? Why did you replace it with the following statement?
    status = success == true? Status.Success : Status.Failure;

    Thanks!

    #13566
    Gavalakis
    Keymaster

    Hello again,

    Thanks for the details. To be completely honest, I can’t recall right now why I replaced the original, as it seems to be more correct.
    I can’t foresee any side effects of turning back on the original. I also did quite a few tests with the original line of code in both BTs as well as FSMs, with various designs and everything seems to work fine. I will keep it for while and see if some issue pops up, even though I really doubt and if so, make the change permanent.

    Thanks for bring this to my attention!

    Join us on Discord: https://discord.gg/97q2Rjh

    #13572
    w
    Participant

    Thanks Gavalakis! I will also keep an eye on it and will update you if any issue comes up.

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