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:
Lower priority node ‘ActionWithLogging “bbb”‘ is running
A condition (If Space Down) triggers the higher priority branch ‘ActionWithLogging “aaa”‘ to execute
ActionWithLogging ‘aaa’ starts (OnExecute)
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?
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!
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.
Author
Posts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.