v0.95 GltfData.Dispose

Now that we are using NativeArray within the importer, we had to discard it at the end. Please dispose of it when you are finished using it.

class GltfData: IDisposable

Example

// must dispose GltfData
using (GltfData data = new AutoGltfFileParser(path).Parse())
using (var loader = new UniGLTF.ImporterContext(data, materialGenerator: materialGenerator))
{
    return await loader.LoadAsync(awaitCaller);
}

If you did not dispose

If the NativeArray is not discarded and is reused for GC, the console displays the following error message:

A Native Collection has not been disposed

You may not know where this error occurred. You can get more details with com.unity.jobs package.

https://forum.unity.com/threads/a-native-collection-has-not-been-disposed-enable-full-stack.1098973/

.

Related