From cc6eea567bc69b83c681dd47408164cab19ed5dd Mon Sep 17 00:00:00 2001 From: ousttrue Date: Thu, 25 Jul 2024 14:08:21 +0900 Subject: [PATCH] =?UTF-8?q?Vrm10Instance=20=E3=81=8C=E7=84=A1=E3=81=84?= =?UTF-8?q?=E7=8A=B6=E6=85=8B=E3=81=A7=20Export=20=E3=82=92=E9=80=9A?= =?UTF-8?q?=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/VRM10/Runtime/IO/Vrm10Exporter.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs index 138a80a90..79bdfc6e9 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Exporter.cs @@ -255,15 +255,21 @@ namespace UniVRM10 int? thumbnailIndex) ExportVrm(GameObject root, Model model, ModelExporter converter, VRM10ObjectMeta vrmMeta, List nodes, ITextureExporter textureExporter) { - var vrmController = root?.GetComponentOrThrow(); - - if (vrmMeta == null) + if (root == null) { - if (vrmController?.Vrm?.Meta == null) + throw new System.ArgumentNullException("root"); + } + + if (root.TryGetComponent(out var vrmController)) + { + if (vrmMeta == null) { - throw new NullReferenceException("metaObject is null"); + if (vrmController.Vrm?.Meta == null) + { + throw new NullReferenceException("metaObject is null"); + } + vrmMeta = vrmController.Vrm.Meta; } - vrmMeta = vrmController.Vrm.Meta; } var vrm = new UniGLTF.Extensions.VRMC_vrm.VRMC_vrm