Editor importer broken
On a clean project in Unity 6000.1.1f1:
Asset import failed, "Assets/3D Models/BobaV2 - GameReady.glb" > InvalidOperationException: The previously scheduled job SortAndNormalizeBoneWeightsJob writes to the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] SortAndNormalizeBoneWeightsJob.bones. You must call JobHandle.Complete() on the job SortAndNormalizeBoneWeightsJob, before you can read from the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrowNoEarlyOut (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <89527d299cb64ba88f87240781b415e5>:0)
Unity.Collections.LowLevel.Unsafe.NativeArrayUnsafeUtility.GetUnsafeReadOnlyPtr[T] (Unity.Collections.NativeArray`1[T] nativeArray) (at <89527d299cb64ba88f87240781b415e5>:0)
GLTFast.VertexBufferBones.ScheduleVertexBonesJob (System.Int32 weightsAccessorIndex, System.Int32 jointsAccessorIndex, System.Int32 offset, GLTFast.IGltfBuffers buffers) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/VertexBufferBones.cs:47)
GLTFast.VertexBufferGenerator`1[TMainBuffer].ScheduleVertexBonesJobs (GLTFast.Schema.Attributes att, System.Int32 i, Unity.Collections.NativeArray`1[T] handles, System.Int32 handleIndex) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/VertexBufferGenerator.cs:373)
GLTFast.VertexBufferGenerator`1[TMainBuffer].CreateVertexBuffer () (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/VertexBufferGenerator.cs:192)
GLTFast.MeshGenerator.GenerateMesh (GLTFast.GltfImportBase gltfImport) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/MeshGenerator.cs:189)
Rethrow as AggregateException: One or more errors occurred. (The previously scheduled job SortAndNormalizeBoneWeightsJob writes to the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] SortAndNormalizeBoneWeightsJob.bones. You must call JobHandle.Complete() on the job SortAndNormalizeBoneWeightsJob, before you can read from the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] safely.)
System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) (at <8db6ec373e6d40bd9d38c8037d358c4e>:0)
System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) (at <8db6ec373e6d40bd9d38c8037d358c4e>:0)
System.Threading.Tasks.Task`1[TResult].get_Result () (at <8db6ec373e6d40bd9d38c8037d358c4e>:0)
GLTFast.MeshGeneratorBase.CreateMeshResult () (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/MeshGeneratorBase.cs:40)
GLTFast.GltfImportBase.CreateAllMeshAssignments () (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/GltfImport.cs:2402)
GLTFast.GltfImportBase.Prepare () (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/GltfImport.cs:2199)
GLTFast.GltfImportBase.LoadFromUri (System.Uri url, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/GltfImport.cs:1208)
GLTFast.GltfImportBase.Load (System.Uri url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/GltfImport.cs:418)
GLTFast.GltfImportBase.Load (System.String url, GLTFast.ImportSettings importSettings, System.Threading.CancellationToken cancellationToken) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Runtime/Scripts/GltfImport.cs:400)
GLTFast.Utils.AsyncHelpers+<>c__DisplayClass1_0`1[T].<RunSync>b__0 (System.Object _) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Editor/Scripts/AsyncHelpers.cs:66)
Rethrow as AggregateException: AsyncHelpers.Run method threw an exception. (One or more errors occurred. (The previously scheduled job SortAndNormalizeBoneWeightsJob writes to the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] SortAndNormalizeBoneWeightsJob.bones. You must call JobHandle.Complete() on the job SortAndNormalizeBoneWeightsJob, before you can read from the Unity.Collections.NativeArray`1[GLTFast.Vertex.VBones] safely.))
GLTFast.Utils.AsyncHelpers+ExclusiveSynchronizationContext.BeginMessageLoop () (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Editor/Scripts/AsyncHelpers.cs:130)
GLTFast.Utils.AsyncHelpers.RunSync[T] (System.Func`1[TResult] task) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Editor/Scripts/AsyncHelpers.cs:73)
GLTFast.Editor.GltfImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.cloud.gltfast@c1ac217282ac/Editor/Scripts/GltfImporter.cs:116)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <a4c13c6b048543258b1eafe39cc26dc5>:0)
This same gltf file opens without issues in https://sandbox.babylonjs.com/
The model will import properly during play mode. And I'm talking about the editor importer, not the runtime one. If I enter play mode, then right click the gltf and select Reimport, it will work.
We have the same issue, it seems to be related to a Glb/glTF file that is exported with multiple objects that are all skinned, or meshes with multiple materials... i.e. when the glb file has multiple meshes, this error occurs.
While the "click reimport while UnityEditor is in play mode" trick does work, this is far from optimal!
(Unity: 6000.1.9f1 glTFast: 6.13.1)
Sorry about the inconvenience,
I think I resolved that in the current development version that's about to be released this week as 6.15.0.
If you want me to reassure, please provide a test asset to reproduce the issue.
Thanks.