From ee1bdc701f079e1f79c8d95e1a613115f9457a46 Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Sat, 3 Aug 2024 01:02:12 +0900 Subject: [PATCH] add exporting support UniUnlit in URP --- .../MaterialIO/URP/Export/UrpGltfMaterialExporter.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Export/UrpGltfMaterialExporter.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Export/UrpGltfMaterialExporter.cs index 01391fe22..f15cc756d 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Export/UrpGltfMaterialExporter.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/MaterialIO/URP/Export/UrpGltfMaterialExporter.cs @@ -4,15 +4,17 @@ namespace UniGLTF { public class UrpGltfMaterialExporter : IMaterialExporter { - private readonly UrpLitMaterialExporter _litExporter = new(); + public UrpLitMaterialExporter UrpLitExporter { get; set; } = new(); + public UrpUniUnlitMaterialExporter UrpUniUnlitExporter { get; set; } = new(); + public UrpFallbackMaterialExporter FallbackExporter { get; set; } = new(); public glTFMaterial ExportMaterial(Material m, ITextureExporter textureExporter, GltfExportSettings settings) { - glTFMaterial dst; + if (UrpLitExporter.TryExportMaterial(m, textureExporter, out var dst)) return dst; + if (UrpUniUnlitExporter.TryExportMaterial(m, textureExporter, out dst)) return dst; - if (_litExporter.TryExportMaterial(m, textureExporter, out dst)) return dst; - - return dst; + Debug.Log($"Material `{m.name}` fallbacks."); + return FallbackExporter.ExportMaterial(m, textureExporter); } } } \ No newline at end of file