I regularly use Unity with Domain Reload disabled under Project Settings. Normally this speeds up entering play mode with no obvious downside.
However, I added the following code within a custom ConditionTask:
Debug.Log($”Agent: {agent.name}”);
and I now get the following error (after entering play mode and hitting that line of code, stopping play mode, and entering play mode a second time and hitting the same line of code again):
MissingReferenceException: The object of type ‘FSMOwner’ has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object.
Interestingly, if I change the code to simply refer to agent (instead of agent.name) I don’t get the error. If I renable Domain Reload I don’t get the error either.
Hmm. This is weird. I always have domain reload disabled as well (even when developing NC for the most part). I tried replicating the issue you mentioned, but I wasn’t really able to. Can you replicate this on a simple graph and let me know how? Also please let me know what version you are using. Thank you.
Yes, I’ve created a simple test project (with only NC and a couple of classes) and replicated the issue. What’s the easiest way to get it to you (and what folders should I include)?
Package Manager tells me I’m on NodeCanvas v3.2.6, and Unity is v2022.3.0f (LTS).
Hello there,
I think there is something missing from the reproduction project you’ve sent because clicking the button does not actually fire up any events (I presume it is supposed to? ). Can you double-check and let me know? If you want to send me any files please do so to support_AT_paradoxnotion.com
Not sure if you’ve had a chance to investigate this, but I think it may be related to OnDisable not always being called for my custom ConditionTask.
So in OnEnable it subscribes to an event, but if OnDisable isn’t called the event isn’t unsubscribed. On entering play mode again, I’ll see multiple subscribers to my event, only one of which will have the agent value set.
Hope that helps.
EDIT: at a basic level, am I correct in thinking that my custom ConditionTask’s OnEnable and OnDisable methods should be called an equal number of times during a single play mode session (from startup to quit)? If I stick Debug.Log statements in each I’m getting a higher count of OnEnable than OnDisable…
OnEnable and OnDisable should indeed be called an equal amount of times, yes. There are also some assertions to check this. In the context of an FSM, Condition Tasks on transitions should be Enabled when their FSM State node is entered, and should be Disabled when that FSM State node is exited.
I tried to replicate a case where OnEnable is called more times than OnDisable, but I wasn’t really able to do so.
Can you please tell or show a minimal reproduction graph that this happens?
I was just in the process of sending you my example project (even captured screenshots showing it step by step), but just before I zipped it up I thought I should try completely deleting the ParadoxNotion folder from the project and reimporting it. Now I can’t replicate the issue!
So apologies for wasting your time. I’m guessing somewhere along the line an upgrade between NodeCanvas versions didn’t work correctly and I was left with a ‘non-standard’ build. In the future I’ll be sure to delete and re-import when installing new versions.
Author
Posts
Viewing 12 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.