SpriteShapeController : InvalidOperationException

,

If you call BakeMesh();

and then have scene unloaded so the SpriteShapeController is destroyed I get :

InvalidOperationException: The previously scheduled job SpriteShapeGenerator writes to the Unity.Collections.NativeArray1[Unity.Mathematics.float2] SpriteShapeGenerator.m_ColliderPoints. You must call JobHandle.Complete() on the job SpriteShapeGenerator, before you can deallocate the Unity.Collections.NativeArray1[Unity.Mathematics.float2] safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at :0)
Unity.Collections.LowLevel.Unsafe.DisposeSentinel.Dispose (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle& safety, Unity.Collections.LowLevel.Unsafe.DisposeSentinel& sentinel) (at :0)
Unity.Collections.NativeArray`1[T].Dispose () (at :0)
UnityEngine.U2D.SpriteShapeController.DisposeInternal () (at Library/PackageCache/com.unity.2d.spriteshape@6.0.1/Runtime/SpriteShapeController.cs:247)
UnityEngine.U2D.SpriteShapeController.OnDisable () (at Library/PackageCache/com.unity.2d.spriteshape@6.0.1/Runtime/SpriteShapeController.cs:267)

Any Idea?

SpriteShape generator runs in a Job. If BakeMesh is called, please make sure to complete this Job before destroying the Object or Unload the scene.

var jobHandle = spriteShapeController.BakeMesh();
jobHandle.Complete();

Otherwise the Job might be running in parallel while the GameObject is being destroyed, hence the error message. Thanks.