From 2edee1e7b5ea99c76491feef359d0d8cfa645999 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 10 Feb 2021 21:24:10 +0900 Subject: [PATCH] MaterialFactory.Dispose --- Assets/UniGLTF/Runtime/UniGLTF/IO/ImporterContext.cs | 9 +++++++-- .../Runtime/UniGLTF/MaterialFacotry/MaterialFactory.cs | 10 ++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) 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(); + } } }