When building a Unity project that includes the A* Pathfinding Project using the Burst compiler, the following message is spammed:
/path/to/project/Library/PackageCache/com.unity.burst@1.5.3/.Runtime/bcl.exe exited after 4397 ms.
An exception was thrown from a function without the correct [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")] guard. Exceptions only work in the editor and so should be only thrown in a function protected by this guard
at Pathfinding.Voxels.Burst.CompactVoxelField.BuildFromLinkedField(Pathfinding.Voxels.Burst.CompactVoxelField* this, Pathfinding.Voxels.Burst.LinkedVoxelField* field) (at /path/to/project/Packages/com.arongranberg.astar@4.3.43/Generators/Utilities/Voxels/CompactVoxelFieldBurst.cs:56)
at Pathfinding.Voxels.Burst.JobBuildCompactField.Execute(Pathfinding.Voxels.Burst.JobBuildCompactField* this) (at /path/to/project/Packages/com.arongranberg.astar@4.3.43/Generators/Utilities/Voxels/VoxelRasterizationBurst.cs:266)
at Unity.Jobs.IJobExtensions.JobStruct`1<Pathfinding.Voxels.Burst.JobBuildCompactField>.Execute(ref Pathfinding.Voxels.Burst.JobBuildCompactField data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\buildslave\unity\build\Runtime\Jobs\Managed\IJob.cs:30)
If we search the A* Pathfinding Project code for ENABLE_UNITY_COLLECTIONS_CHECKS
, we can see some instances that do have a safeguard.
But many throw statements are lacking safeguards, this should be fixed to avoid the error spam when building.
(PS: I had to split the constant name in the bugreport tilte because the forum software complained about a word in the title being too long)
Here all error messages relating to this safeguard we get each build:
It’s not obvious to me that just not throwing the exception if such a critical condition was detected is the correct choice. If something critical happened that is worth throwing an exception, then it might be more reasonable to abandon the program execution instead of continuing like nothing happened.
See this documentation site, one can also surpress the warning:
https://docs.unity.cn/Packages/com.unity.burst@1.6/manual/docs/Warnings.html
(Perhaps the assembly definition should be changed, so that the Drawing package is only included in the editor, but not the build. However there are also files affected in the Generators/ folder, which appears to be a requirement for the non-editor build.)
Using Unity 2020.3.7f1 and Burst 1.5.4.