It seems there is a bug with elapsedTime in nested Behavior Trees if the Behavior Tree has an updateInterval set.
This way only the last frame deltaTime will be passed to nested BT when it should pass the accumulated time since the last update.
This makes the Wait Action to run slower in the nested BT then it runs in parent BT which is not correct.
said Daniel in Discord.
In addition, the cooldown decorator also doesn’t work in a subtree for this reason you said.
It seems that the parent graph is repeatedly entering/exiting the subgraph and as a result the subgraph is reset (along with its nodes) each time it re-starts. I could probably make the Cooldown node independent of that and dependant on Time alone.
Is this feature under development?
I attached png ‘edit01’ for the elapsedTime issue and ‘edit02’ for the cooldown issue. I’m not sure whether this is the right way.
To be totally honest I was almost about to remove the “update interval” option that Behaviour Trees have a couple of versions back. No other type of graph in NodeCanvas has such an update interval and because of that (as you can see) it creates more problems than benefits (I think). Is keeping the “update interval” option critical for you and would it be a problem if it was actually removed?
Bumping this up as I just faced this same exact problem with the Cooldown filter.
I had a big behaviour tree that I just split in subtrees and then some of them didn’t work as intended as the cooldown is reset everytime the subtree stops. This behaviour makes this decorator unusable on subtrees as this will happen everytime a success is returned down the graph.
Right now what I’m doing to workaround this is to create a custom decorator based on the filter and commenting out the currentTime reset in the OnGraphStoped() function.
Attached is a screenshot of the the working code for this particular scenario.
Please let me know if I’m missing something here or if there are major concerns with this approach.