A* Pathfinding project crashing game in build


We’ve been using this pathfinding solution for quite a while now and it has always worked well. Now however I’ve run into an issue with A* pathfinding crashing the project in build. As we’ve also been in contact with unity about the crashes, as we’ve had some problems with unity bugs, they helped us dig up some more about the error. It seems to have to do with a memcpy happening on the pathing thread. We haven’t been able to generate a crash dump from it. But we’ve been able to get a call stack. Anyone know wha this could be, and how to solve it?

The version of Unity being used, 2018.4.3f1.
Version of A* pathfinding project: 4.2.5

Crash Callstack:

UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
AstarPath:LogPathResults(Path) (at Assets\AstarPathfindingProject\Core\AstarPath.cs:835)
AstarPath:<InitializePathProcessor>b__122_1(Path) (at Assets\AstarPathfindingProject\Core\AstarPath.cs:1297)
Pathfinding.PathProcessor:CalculatePathsThreaded(PathHandler) (at Assets\AstarPathfindingProject\Core\Misc\PathProcessor.cs:386)
Pathfinding.<>c__DisplayClass24_0:<.ctor>b__0() (at Assets\AstarPathfindingProject\Core\Misc\PathProcessor.cs:110)
System.Threading.ExecutionContext:RunInternal(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object, Boolean)
System.Threading.ExecutionContext:Run(ExecutionContext, ContextCallback, Object)


How did you come to the conclusion that it was due to a memcpy?

That conclusion was reached by the Unity engineer working on my support ticket. I’ve submitted an image of what he said, the log at the bottom of the image is just the one i pasted in the previous post. image

The crash seems to specifically trigger when there are a lot of paths that can’t be reached. In our game, the units default to simply walking straight towards their destination, the bird route, without pathfinding if a path couldnt be found. But when it happens over and over again, the crash happens with that stack trace. But the more i look into it, I understand why you’re sounding hesitant that the pathing is to blame here. As the stack trace quite clearly points to a unity debug.log.

Have gotten more information from Unity about the crash. Hopefully this answer from Unity makes more sense to you than the previous call stack i posted.

Bump! Our game is running into this as well, and it is also when many agents cannot calculate a path to their target. I’ve attached the editor log of the most recent crash.
Editor.txt (724.1 KB)


This looks very much like a Unity bug. I’d recommend trying to upgrade to the latest version of Unity. Or if that doesn’t help, reporting the bug to Unity.

Hi Aron,

We’d love to upgrade Unity but we have a different problem preventing us from doing so. This is Unity’s problem as well, but I figure at least google can index this in a couple places: upgrading from Unity 2019.2.21 to the current 2020 LTS version causes a unique error to show up for us that can prevent the game from being built at all, and is a constant source of log file entries even when we can: Do not use ReadObjectThreaded on scene objects!

In our case, it seems that it may be related to some quirk in Unity’s terrain system of all things, but we haven’t received anything back from them.

More specific to the topic of these crashes, what makes you perceive this to be a Unity bug? Is there something in the log there that I can look out for in the future?

The crash seems to be a memory-related crash from code that should be just safe managed C#. That kind of crash is almost certainly either a .net bug or a Unity bug.

1 Like