Large recasts, standalone crash

Hi Aron, I’ve been running into serious stability issues with additively loaded recastgraphs. Interestingly things seemed to slowly be getting worst with recent versions of Unity, until 2020 where I’m getting crashes almost instantly.

I’m not doing any scanning/updating of graphs at runtime. I’m doing all my scanning in the editor, and saving to a byte file. My graphs are fairly large, about 4kx4k dimensions, and can be several megabytes in size.

I’m getting crashes in both my project and a completely empty one with nothing but the pathfinding asset while attempting to additively load a graph. I’ve attempted creating the graph several different ways, but always keeping it fairly large in size. I don’t believe it matters if there are any other AI updates going on (seekers and such).

Also, and I’m not sure if this is relevant, but in previous versions of Unity I noticed that I was more likely to crash if I spun the camera to view any potential graphs on the screen, almost like it was attempting to render the graph and encountering an error. I almost wonder if the graphs are still being updated somehow, based on what’s in the scene?

FYI, this is ONLY with standalone builds… in editor it’s always rock-solid. Very hard to try and debug, though disabling any threads seems to help narrow things down.

Edit: This might not be isolated to DeserializeGraphsAdditive, though that seems to cause more issues than DeserializeGraphs.


Do you have any stack traces for this? Or any error messages at all?

Hi Aron, usually it’ll softlock and Windows will ask if I want to shut the standalone down. On occasion I’ll get a proper crash to desktop.

I’ll PM you a package with a crash.dmp.


I have tried the project you sent me. I can replicate the instant crashes in Unity 2020 with various build parameters but I cannot replicate it in 2019.3. The crashes seem to happen in 2020 inside the memory allocator. From what I can tell this is a Unity bug and not a bug in this package. I see no obvious way to fix it or work around it.
I would suggest that you send the same package that you sent me to Unity so that they can fix the bug.

Hmm, ok I’m glad to know it’s not just me. Would you mind sending it to Unity? You would know better what specific issues they should look for. My instructions are so vague I’d worry they wouldn’t know what to look for.

As for pre-2020, it was a pretty uncommon crash, but I could almost always replicate it in my own project by spinning the camera around, generally in the area where the graph would exist if it were being rendered. Definitely not 2020-levels of instant crashing though.


I have now sent a bug report to Unity:

1 Like

Many thanks, deeply appreciated! I hope they can iron it out. For now I’ll just omit those methods in my builds.

1 Like

Unity managed to replicate it finally!

You can vote on the issue here:

Awesome, thanks for keeping at it! Voted!

Do you have any idea roughly where this is being done? Based on which components I’m using I’m wondering if there’s a way around it until Unity resolves it.

No idea what is causing it really. I tried hard to narrow it down, but it seems to be some kind of bug in the garbage collector which makes it veery elusive.

Just saw Unity’s response in FogBugz, hoping this is indeed a fix!

Yes! I saw it too. Great news.

Let me know if it works for you.

Hi Aron, minor update. I recently upgraded to 2020.1.0f1 and it seemed to resolve the crashing issues we were running into. So far so good, again thank you for staying on top of this and bugging Unity about it!

1 Like