SynchronizationLockException error

I’ve been running into a really weird error. Sometimes (seemingly randomly) I get the following error:

SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code. Pathfinding.ThreadControlQueue.Pop() (at Assets/AstarPathfindingProject/Core/Misc/ThreadControlQueue.cd:215)

followed by:

Unhandled exception during pathfinding. Terminating.

This happens at random intervals, and even when I’m not running any code. I’m at a very early stage of my games development and I have a button in the unity editor that lets me start running code. Before I press that button the game is basically an empty scene with no code running but I still get this error. After I actually generate a point graph (which I do at runtime), this error crashes my game and wipes my nav mesh out. My game can run for hours without it happening or it can happen shortly after starting. Let me know what else you need from me to get to the bottom of what I’m doing wrong. Thank you

Hey,

We’ll have to wait for Aron for this one.
Sorry for the inconvenience.

Hey there,

pushing this topic… I am also seeing this error every 1 of let’s say 10 game starts…

SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.
Pathfinding.ThreadControlQueue.Pop () (at Assets/Packages/AstarPathfindingProject/Core/Misc/ThreadControlQueue.cs:215)
Pathfinding.PathProcessor.CalculatePathsThreaded (Pathfinding.PathHandler pathHandler) (at Assets/Packages/AstarPathfindingProject/Core/Misc/PathProcessor.cs:304)
UnityEngine.Debug:LogException(Exception)
Pathfinding.PathProcessor:CalculatePathsThreaded(PathHandler) (at Assets/Packages/AstarPathfindingProject/Core/Misc/PathProcessor.cs:407)
Pathfinding.<>c__DisplayClass24_0:<.ctor>b__0() (at Assets/Packages/AstarPathfindingProject/Core/Misc/PathProcessor.cs:110)
System.Threading.ThreadHelper:ThreadStart()

I’ve heard about this error from time to time but I’ve never been able to replicate it. I think it’s due to some particular combination of platform and compiler, but it’s hard to tell.
Which platform and player settings are you using?

Hmm, do you get this when the game starts really?

Are you sure it is not after you have edited some script inside play mode and then Unity recompiles the scripts?

I have updated the beta with a possible fix for this.