Unknown error causes Async loaded tree to fail

mdotstrange

New member
The tree works when async in not checked- if it is checked I get this error



It doesn't hint towards code that isn't thread safe like the previous errors I got with the movement pack. I tried isolating/deleting tasks for about an hour to figure out what task was causing the issue. Couldn't figure it out so I downloaded the BD source. I'll make a duplicate of my project and run it using the source code to get a better idea of what is going on tomorrow. Any idea what it might be? Thanks.
 

Justin

Administrator
Staff member
Yeah if you can download the source and include line numbers that would be great.
 

mdotstrange

New member
Ok here's the line numbers from the source-

BehaviorManager.cs lines 438 and 374

Error image



Debugged a tiny bit and it seems the BehaviorTree getting passed to that method is null
 

Justin

Administrator
Staff member
Could have the behavior tree been disabled while it was still loading? In any case if you add the following to the top it should get rid of that error:

Code:
            if (behavior == null || behaviorTree == null) {
                return;
            }
 

mdotstrange

New member
I added that at the beginning of the AsyncLoad.. method- The error goes away but the tree is not loaded-

Could it be a serialization issue? It's odd that all the other tree's work with aync loading that are using the same tasks as the tree that is failing- I went from 1.6.1 -> 1.6.3

I tried removing the Bt component/adding a new one, I tried creating a new prefab and running it on that as well-

The tree throwing errors is using 2 external trees inside of it- if I delete the 2 trees async loading works- One of the external trees that must be deleted to stop errors is used in the other enemies who load correctly with async-

I've examined the other ext tree tasks looking for code that isn't thread safe etc and didn't find anything- some of them do use Linq in them though-

I haven't tested all my enemies but the one throwing errors is 1 out of 16 so I can just not using async loading with that one.
 

Justin

Administrator
Staff member
At that point the tree is already deserialized so I think that it's something else.

Can you send me a repro scene? I can take a closer look at what it is doing.
 

mdotstrange

New member
I tried to get a project together to export after work but there's so many custom classes I'm referencing its tough to export and standalone scene without including tons of scripts- I'll try again tomorrow after work-

But I did do some more debugging and I believe its a variable clashing issue- I've isolated it to two external trees- on their own they load fine using Async and no Async but if they are used in the same master tree together they load fine with Async disabled but cause that error with Async enabled-

I had an issue years ago where variables had the same name but different type in BD causing tree failures with External trees so I'll check that thoroughly tomorrow as well-

I'll go through it task by task and variable by variable until I find the issue-

Thanks for your help.
 
Top