I’ve recently been running into an issue where if one BehaviourTree causes another BehaviourTree to Pause, the second BehaviourTree would immediately resume itself.
From what I can tell this seems to be related to the invocation order of the MonoManager onUpdate Action.
If the pausing BehaviourTree is first in the invocation list, the second one will be unsubscribed but will still call UpdateGraph() once because they were still on the invocation list when the event was initially invoked.
If it’s the other way around everything works as expected as the now paused BehaviourTree already went through their UpdateGraph() before being paused.
The solution that I’ve come up with for this is adding a justPaused field to the Graph class that is checked in UpdateGraph(). If true, unset it and do nothing. StartGraph(), Stop(), and Resume() would set the value to false, with only Pause() setting it to true.