From a76a11c330bda11af584e19d9fb8333396ee2fd8 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 17 Feb 2025 15:10:06 +0900 Subject: [PATCH] fix Vrm10Viewer when RenderPipeLine is built-in. --- .../VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs index c6e7bd2f9..87193c97e 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs @@ -499,8 +499,14 @@ namespace UniVRM10.VRM10Viewer private void Start() { - m_mtoonImporter = new(m_mtoonMaterialOpaque, m_mtoonMaterialAlphaBlend); - m_pbrImporter = new(m_pbrOpaqueMaterial, m_pbrAlphaBlendMaterial); + if (m_mtoonMaterialOpaque != null && m_mtoonMaterialAlphaBlend != null) + { + m_mtoonImporter = new(m_mtoonMaterialOpaque, m_mtoonMaterialAlphaBlend); + } + if (m_pbrOpaqueMaterial != null && m_pbrAlphaBlendMaterial != null) + { + m_pbrImporter = new(m_pbrOpaqueMaterial, m_pbrAlphaBlendMaterial); + } m_autoEmotion = gameObject.AddComponent(); m_autoBlink = gameObject.AddComponent(); @@ -520,7 +526,10 @@ namespace UniVRM10.VRM10Viewer Motion = BvhMotion.LoadBvhFromText(m_motion.text); if (m_useCustomMaterial.isOn) { - Motion.SetBoxManMaterial(Instantiate(m_pbrOpaqueMaterial)); + if (m_pbrAlphaBlendMaterial != null) + { + Motion.SetBoxManMaterial(Instantiate(m_pbrOpaqueMaterial)); + } } } @@ -792,7 +801,7 @@ namespace UniVRM10.VRM10Viewer IMaterialDescriptorGenerator GetMaterialDescriptorGenerator() { - if (m_useCustomMaterial.isOn) + if (m_useCustomMaterial.isOn && (m_mtoonImporter != null || m_pbrImporter != null)) { return new OrderedMaterialDescriptorGenerator(m_mtoonImporter, m_unlitImporter, m_pbrImporter); }