From 90be6dc76346076d2a890364caa33124888a54b3 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 27 Feb 2019 17:28:14 +0900 Subject: [PATCH] glTF.extensions.VRM default value to null fix for none VRM exporter --- Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs | 2 ++ Assets/VRM/UniVRM/Scripts/Format/VRMFormat.cs | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs index 85f763e22..5d690a094 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMExporter.cs @@ -16,11 +16,13 @@ namespace VRM public VRMExporter(glTF gltf) : base(gltf) { gltf.extensionsUsed.Add(glTF_VRM_extensions.ExtensionName); + gltf.extensions.VRM = new glTF_VRM_extensions(); } public new static glTF Export(GameObject go) { var gltf = new glTF(); + using (var exporter = new VRMExporter(gltf) { #if VRM_EXPORTER_USE_SPARSE diff --git a/Assets/VRM/UniVRM/Scripts/Format/VRMFormat.cs b/Assets/VRM/UniVRM/Scripts/Format/VRMFormat.cs index 501328e15..9c0d7a7ec 100644 --- a/Assets/VRM/UniVRM/Scripts/Format/VRMFormat.cs +++ b/Assets/VRM/UniVRM/Scripts/Format/VRMFormat.cs @@ -7,12 +7,15 @@ namespace UniGLTF { public partial class glTF_extensions : ExtensionsBase { - public VRM.glTF_VRM_extensions VRM = new VRM.glTF_VRM_extensions(); + public VRM.glTF_VRM_extensions VRM; [JsonSerializeMembers] void VRMSerializeMembers(GLTFJsonFormatter f) { - f.Key("VRM"); f.GLTFValue(VRM); + if (VRM != null) + { + f.Key("VRM"); f.GLTFValue(VRM); + } } } }