I have this tree which I reuse as needed (attached to a pooled object). The problem I am having is that the tree is not reset properly. Glav, you mentioned on Discord that the tree should reset when disabled and then enabled.
In this tree you can see it’s supposed to be start the 2nd Filter (do stuff, wait for 0.5 seconds …). However, it resumes the loop from when it was disabled.
Thanks for the detailed info.
This should definetely not happen and the most unfortunate thing, is that I can’t replicate this somehow. When I stop and then (re) start a behaviour, it always restarts as expected, starting with the first node.
Do you by any chance, stop the behaviour from within the behaviour tree itself (like for example calling StopBehaviour() with an Execute Function, or from within a custom action task)?
Do you think that you can replicate this problem you are facing with a simpler behaviour tree, or a behaviour tree that you can share with me through email?
The good news is that it’s not a problem with Node Canvas. It’s more to do with the way I was expecting order of events.
I set a counter variable for some initialisation to run just once each time when enabled. After trying to replicate it I found the BT runs immediately when enabled, just before I increase counter variable. So it skips the filter (as the counter is not yet updated) and continues running normally (reaching the loop), by which time the counter is then updated.
I can get around this by setting OnEnable to DoingNothing on the Tree and start the behaviour in the code after increasing the counter.
Hello again.
Thanks for the follow up.
For your information, in the latest version of NodeCanvas, the first time call to Start the behaviour, has been moved from “OnEnable”, to “Start”. This means that you are now able to call custom code in “Awake”, making sure that it’s called before the behaviour starts, which seems to be the issue in your case.
Thanks 🙂
Join us on Discord: https://discord.gg/97q2Rjh
Author
Posts
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.