From 6b43069eb902e8f3368515bccd356a778d7ab58d Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Fri, 22 Oct 2021 18:58:10 +0900 Subject: [PATCH] Remove RuntimeGltfInstance before saving a prefab. --- Assets/VRM/Editor/Format/VRMEditorImporterContext.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs b/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs index f29d76f10..ae0946d36 100644 --- a/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs +++ b/Assets/VRM/Editor/Format/VRMEditorImporterContext.cs @@ -141,6 +141,9 @@ namespace VRM loaded.TransferOwnership(SaveAsAsset); var root = loaded.Root; + // Remove RuntimeGltfInstance component before saving as a prefab. + UnityObjectDestoyer.DestroyRuntimeOrEditor(loaded); + // Create or update Main Asset if (m_prefabPath.IsFileExists) { @@ -155,7 +158,7 @@ namespace VRM } // destroy GameObject on scene - GameObject.DestroyImmediate(root); + UnityObjectDestoyer.DestroyRuntimeOrEditor(root); foreach (var x in m_paths) {