OnStop called after and OnExecute when using dynamic selector

NodeCanvas Forums Support OnStop called after and OnExecute when using dynamic selector

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #16154


    I’ve run into an issue using dynamic selector’s in a BT. I’ve managed to reproduce it in a very simple example (see attachment for setup).

    What is happening is that when the higher priority branch is being triggered, the ‘OnStop’ of the lower priority branch is being called  after the ‘OnExecute’ of the higher priority node.

    The example sequence is:

    1. Lower priority node ‘ActionWithLogging “bbb”‘ is running
    2. A condition (If Space Down) triggers the higher priority branch ‘ActionWithLogging “aaa”‘ to execute
    3. ActionWithLogging  ‘aaa’ starts (OnExecute)
    4. ActionWithLogging  ‘bbb’ stops (OnStop)


    This is causing me issues since I need to do cleanup in ‘OnStop’ but it can override the setup of the other nodes ‘OnExecute’. It lead to some real hard to track down bugs until I realized what was going on.

    Is this the intended behavior? Is there anyway to ensure actions are completed before the next ones are executed?

    You must be logged in to view attached files.

    Hello there,

    This has been discussed a while back and the reason this happens is because the way it is implemented now, the dynamic selector (or sequencer) to interrupt the lowest priority node (right), the highest priority node (left) has to have begun its execution already. With that said, I do understand the confusion and this is high in priority to change for it to work in a more expected way!

    Thank you!

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


    Thanks for the info.

    For now I’m working around the issue by creating an Action task that simply yields until the next frame before calling EndAction(). If I place this before the task in the higher priority node sequence I get the expected behavior so I don’t need to guard against this elsewhere.

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