NodeCanvas Forums › Support › OnCheck callback not being executed on ConditionTask.cs
So I’m looking for some tips as to what I’m missing or doing wrong here…
Long story short, I’ve noticed that the OnCheck() virtual callback on the ConditionTask.cs script stops being called in some weird instances. So on our game we have to despawn enemies and return them to a pool of sorts for storage and better memory management. On that process, I use PauseBehaviour() function of the GraphOwner.cs component, and when I activate it again, I use the GraphOwner.StartBehaviour() in order to kick things into gear. In a few instances, I’ve noticed the behaviour tree, despite not being paused, stops responding to requests and checks, since most of my logic depends on the function OnCheck() being caled, so the overrides that I’ve implemented do the things I need it to do. I’m not exactly sure what could be happening, so I’ve come here to ask for some clues as to where to look. Thanks for the help!
Hello there and sorry for the late reply.
Is this happening only after you re-enable the enemy / behaviour tree?
Could you please share a screenshot of your behaviour tree, or even better a video of it at the point where it does not work as expected and the nodes that are related?
Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
Hello! Sorry about taking awhile, but I’ll try to send a video and screenshots of the segments of code in question.
I’ve uploaded a small recording and set it up on youtube on a non listed video:
Its somewhat weird because it works most of the time, but I’ve noticed that rarely, if we get an error message somewhere else in the game, say a missing ref or a shader problem, the whole behaviour tree becomes unresponsive since I need the callback from the OnCheck function working. Took a bit to realize that ceased to be happening, and why my NPCs were acting up.
As for the questions: it usually happens after the behaviour tree is re-enabled, yes. Hoping that can give enough hints as to what is happening hahaha!
Cheers!
Edit: put the screenshots as attachments
Hello,
Hmm. You are using a quite old version of NodeCanvas. May I suggest that you update to the latest version please? There are a few small breaking things when updating to v3+ (please see the change log), but these are only related to prefabs, and v3+ has a lot of new things and fixes of course 🙂
Let me know. Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
Heya! Sorry about taking a bit. I’ve gotten the latest version of the asset, but I think I might have to manually delete a few things of the older version. There seems to be plenty of duplicate definitions, for instance “EventData” that is defined on EventData.cs AND IEventData.cs, that sort of stuff. I’ll try to fix it and then test the original problem in terms of stability, will keep you posted if I can sort this stuff out
Ok, managed to update to 3.26 by the older version and fixing a few function calls, but I seem to be having problems with the ProbabilitySelector.cs, line 50…IndexOutOfRangeException kind of error…trying to figure stuff out still, sorry about that, will keep you posted if I manage to make this upgrade work seamlessly.
Hello again. I am sorry about that, there are indeed some small breaking changes upgrading from pre 3.x version to post 3.x.
May I suggest that you please remove and re-add the probability selector (or right-click on the node, choose replace, and select Probability Selector again). Just do note that this will sadly reset your weights though.
Join us on Discord: https://discord.gg/97q2Rjh
I’m so sorry for taking awhile to follow up on this, but I had to test things to get a clearer idea of…even how to ask on how to go about doing this. Here’s our issue:
It seems like the problem persists now, where the behaviour tree stops doing its callbacks of the “update” sort during its execution. We don’t seem to have any sort of erros on the console, and I cant seem to reproduce this on the editor…
…the problem now lies with the fact that its easily reproduced on the build. Is there a way to activate the Node Console, either getting a dump of logs or automatic errors from the behaviour tree, on a build setting?
What I have tried to either fix or pinpoint the problem: We have used in the past an event from MonoManager.current.OnFixedUpdate to sign in a function of our own to call the updates on a fixed rate. I thought that could be the issue, and since I had it changed back to just using a simple override of the OnUpdate function to call it internally. It does not seem to have fixed things.
I’m not…exactly sure of how to proceed from here. But since node is kind of a base of our whole enemy AI system, its uh….
…quite the pickle.
An example of the Tick callbacks we are…seemly not getting. Thought maybe I had some sort of start setup issue, but since the problem only happens midway during gampley, at…what appears to be random times, I guess I’m looking for clues as how to pinpoint where the problem is using maybe a resource of Canvas that I’m not aware of.
Thanks for you time!
Hello and sorry for the late reply due to summer vacation.
The node console logs are just normal Unity logs that are catched by the console if it is open, so these logs should also be dumped just like normal Unity logs in build.
Regarding the issue you are facing. You initially had an issue with ConditionTask, however now you are referring to ActionTask, which got me a bit confused 🙂 Can you please clarify?
Also does this only happens with some custom task you have made, or is there any other way I can replicate this on my end?
Please let me know. Thanks!
Join us on Discord: https://discord.gg/97q2Rjh