Unity Freezes when I click Play in the editor

Hi

I recently downloaded the package (4.0.11) and followed the 2D pathfinding tutorial to create a graph for AI navigation.
it is very simple and very similar to the one created in the tutorial video.
However, every once in a while, when I click Play in the editor, Unity will freeze and I need to kill the process. So far it happened twice since adding the package to my unity project.

After digging thru the Unity editor logs I found that the crash happens during/after graph scanning so I pretty sure this is related to the A* pathfinding package.

Packing sprites:
[     72 MB ]- Skipping packing - Sprite Packer (Legacy) is off.
[     72 MB ]Sprite Atlas Operation : " ## Packed All Sprite Atlases ## " took 0.001756 sec (current mem: 72 MB)
Reloading assemblies for play mode.
Begin MonoManager ReloadAssembly
Refreshing native plugins compatible for Editor in 0.54 ms, found 4 plugins.
Preloading 2 native plugins for Editor in 0.12 ms.
Mono: successfully reloaded assembly
- Completed reload, in  1.180 seconds
Initializing Unity.PackageManager (PackageManager) v2017.2.0 for Unity v2017.2.0f3
Registering platform support modules:
Registered platform support modules in: 0.08145s.
Native extension for Android target not found
Native extension for iOS target not found
Native extension for WindowsStandalone target not found
Load scene 'Temp/__Backupscenes/0.backup' time: 1.355797 ms 
Pre processing graphs
Scanning graph 1 of 1 - 
Scanning graph 1 of 1 - Creating nodes
Scanning graph 1 of 1 - Calculating positions
Scanning graph 1 of 1 - Calculating connections
Scanning graph 1 of 1 - Calculating erosion
Scanning graph 1 of 1 - Assigning graph indices
Post processing graphs
Computing areas
Late post processing
Crash!!!

even though it says crash, Unity doesn’t actually crash. It freezes until I kill it from Task Manager.
the rest of the log contains the stack trace which has a lot of references to the A* pathfinding package

I am running the latest stable version of Unity (2017.2.03f)

any help would be greatly appreciated.

Hi

If it says ‘Crash’ like that I’m pretty sure it is a Unity bug as my package never writes that.
However if you had the stack trace, do you think you could post that? It would be very useful to have.

Hi,

Since unity doesn’t actually crash, but freezes ,I assume the ‘Crash!!!’ is written to the log by Unity when I manually kill the process from the Task Manager and also possibly writing the stuck trace. (I wish the log had time stamp)

Another minor thing I noticed, and I am not 100% sure is it related to the freeze, is the debug level in the Pathfinding script. By default, it is set to Normal but I started experiencing the freeze when I change that to None. Right now, I put it back to Normal to see if I still experience the radon freeze

I saved the entire editor log just in case and I am happy to send it to you. Is it safe to post it on the forum? otherwise, is there a way I can send it to you privately.

Thank you,

Hi

Yes you can post it here.

Okay. I’ll post it as soon as I get home.

UPDATES SINCE LAST POST:

  1. The freeze happens even when the debug verbosity is set to None so I guess they are not related.
  2. while the editor is frozen I opened the log file and noticed that Unity already printed the entire stack trace including the Crash!!! line so that’s interesting. It tells me that Unity detected the crash but somehow the editor itself remained frozen. Also the Crash!!! line always appears immediately after the AstralPathfinding stuff. (you’ll see that in the log)
  3. Since the rate of freezing was intolerable for me, I made the hard decision and completely removed the package from my project. Since then, Unity hasn’t froze or crashed at all, but now I am left with no AI in my game.
  4. strangely enough, I made a build with the AstralPathfiniding AI package and installed it on my iPhone. No issues whatsoever, so there seem to be an issue only with the Unity editor.

Hope that findings help. I’ll send you the log later.

Cheers,

I get the following message “Sorry, new users cannot upload attachments” when I try to post the log.

any suggestions.

Hi

You can upload it to pastebin or something similar.

one more thing I forgot to mention - my project is configured to use the new scripting backend - .net 4.6
not sure if that makes any difference (it shouldn’t ) but just wanted to throw it out there.

Hi

That decidedly looks like a compiler or .net runtime bug. It doesn’t seem like anything my package does incorrectly. I suggest that you send this stacktrace (not the full log) to Unity so that they can try to debug it.
In the mean time, it is possible to disable that particular code that was causing the error by going to the ‘Optimizations’ tab in the A* Inspector and then enable the ASTAR_NO_POOLING option. This will increase the amount of allocations that are being done, but hopefully it will not trigger this error.

Unfortunately the ‘Optimizations’ tab in the A* Inspector is not available in the Free version

The only thing I haven’t tried is changing the scripting engine back to .NET 3.5 (the stable one) but at this point in my project I have too much c# 6 code.

Hi

You can get the same result if you open the ArrayPool.cs file, ListPool.cs file and ObjectPool.cs file and add the line

#define ASTAR_NO_POOLING

to the top of the script.

Thank you very much.
Just wanted to let you know that yesterday Unity froze on me again, but this time on a completely different project that does not have the A* package installed. I checked the log and the error was exactly the same. I filed a second bug report, because now I am certain this is a Unity/Mono run time bug. in fact, someone on the forum thinks it is a bug with the mono garbage collection. who knows.
one lesson I learned from this -> when something is labeled as experimental, there is probably a good reason why.

Cheers

1 Like