From a552230f4cbaa371796df7f08474f64fe0516d73 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 26 Feb 2024 16:12:06 +0900 Subject: [PATCH] =?UTF-8?q?headless=20mesh=20=E3=82=92=20destroy=20?= =?UTF-8?q?=E5=AF=BE=E8=B1=A1=E3=81=AB=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs | 5 +++++ .../Runtime/Components/VRM10Object/VRM10ObjectFirstPerson.cs | 1 + 2 files changed, 6 insertions(+) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs b/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs index 99cfaf86b..73c3e7a33 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/RuntimeGltfInstance.cs @@ -221,6 +221,11 @@ namespace UniGLTF Destroy(oldResource); } + public void AddResource(T resource) where T : UnityEngine.Object + { + _resources.Add((SubAssetKey.Create(resource), resource)); + } + void OnDestroy() { foreach (var (_, obj) in _resources) diff --git a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectFirstPerson.cs b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectFirstPerson.cs index 6ac7f1b83..812264422 100644 --- a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectFirstPerson.cs +++ b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectFirstPerson.cs @@ -104,6 +104,7 @@ namespace UniVRM10 headless.transform.SetParent(smr.transform, false); if (runtime != null) { + runtime.AddResource(headless.sharedMesh); runtime.AddRenderer(headless); } }