diff --git a/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs b/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs index d1c74ef03..b498f9463 100644 --- a/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs +++ b/Assets/VRM/UniVRM/Editor/Format/VRMExporterWizard.cs @@ -181,11 +181,6 @@ namespace VRM } var renderers = ExportRoot.GetComponentsInChildren(); - if (renderers.All(x => !EnableRenderer(x))) - { - yield return Validation.Error(Msg.NO_ACTIVE_MESH); - } - var materials = renderers.SelectMany(x => x.sharedMaterials).Distinct(); foreach (var material in materials) { @@ -373,8 +368,10 @@ namespace VRM } EditorGUILayout.LabelField("ExportRoot"); - var root = (GameObject)EditorGUILayout.ObjectField(ExportRoot, typeof(GameObject), true); - UpdateRoot(root); + { + var root = (GameObject)EditorGUILayout.ObjectField(ExportRoot, typeof(GameObject), true); + UpdateRoot(root); + } // // ここでも validate している。ここで失敗して return した場合は Export UI を表示しない @@ -383,21 +380,29 @@ namespace VRM // // root // - if (root == null) + if (ExportRoot == null) { Validation.Error(Msg.ROOT_EXISTS).DrawGUI(); return; } - if (root.transform.parent != null) + if (ExportRoot.transform.parent != null) { Validation.Error(Msg.NO_PARENT).DrawGUI(); return; } - if (root.transform.localRotation != Quaternion.identity || root.transform.localScale != Vector3.one) + if (ExportRoot.transform.localRotation != Quaternion.identity || ExportRoot.transform.localScale != Vector3.one) { Validation.Error(Msg.ROOT_WITHOUT_ROTATION_AND_SCALING_CHANGED).DrawGUI(); return; } + + var renderers = ExportRoot.GetComponentsInChildren(); + if (renderers.All(x => !EnableRenderer(x))) + { + Validation.Error(Msg.NO_ACTIVE_MESH).DrawGUI(); + return; + } + if (HasRotationOrScale(ExportRoot)) { if (m_settings.PoseFreeze) @@ -424,7 +429,7 @@ namespace VRM // // animator // - var animator = root.GetComponent(); + var animator = ExportRoot.GetComponent(); if (animator == null) { Validation.Error(Msg.NO_ANIMATOR).DrawGUI();