From da7d1db04d82f3ecdee3bb57c33bdb8fe1cc0b24 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 15 Feb 2021 13:54:37 +0900 Subject: [PATCH] dispose, new --- Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs index 53fd5ae6d..25f231224 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs @@ -270,6 +270,7 @@ namespace UniGLTF throw new UniGLTFException("unknown gltf version {0}", GLTF.asset.version); } + m_textureFactory = new TextureFactory(GLTF, Storage); m_materialFactory = new MaterialFactory(GLTF, Storage); // Version Compatibility @@ -941,7 +942,6 @@ namespace UniGLTF if (Root != null) GameObject.Destroy(Root); // Remove resources. materials, textures meshes etc... - MaterialFactory.Dispose(); foreach (var x in Meshes) { UnityEngine.Object.DestroyImmediate(x.Mesh, true); @@ -950,6 +950,8 @@ namespace UniGLTF { UnityEngine.Object.DestroyImmediate(x, true); } + MaterialFactory.Dispose(); + TextureFactory.Dispose(); } #if UNITY_EDITOR