diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs index 12622452e..647601e35 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs @@ -939,9 +939,14 @@ namespace UniGLTF if (Root != null) GameObject.Destroy(Root); // Remove resources. materials, textures meshes etc... - foreach (var o in ObjectsForSubAsset()) + MaterialFactory.Dispose(); + foreach (var x in Meshes) { - UnityEngine.Object.DestroyImmediate(o, true); + UnityEngine.Object.DestroyImmediate(x.Mesh, true); + } + foreach (var x in AnimationClips) + { + UnityEngine.Object.DestroyImmediate(x, true); } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs b/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs index 22cd4788a..c6d6687c8 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; @@ -11,7 +12,7 @@ namespace UniGLTF public delegate MaterialItemBase MaterialImporter(int i, glTFMaterial x, bool hasVertexColor); - public class MaterialFactory + public class MaterialFactory : IDisposable { MaterialImporter m_materialImporter; public MaterialImporter MaterialImporter @@ -189,5 +190,10 @@ namespace UniGLTF return new PBRMaterialItem(i, x); } + + public void Dispose() + { + throw new NotImplementedException(); + } } }