diff --git a/Core/Scripts/IO/MaterialExporter.cs b/Core/Scripts/IO/MaterialExporter.cs index 1c2314e..9fddd69 100644 --- a/Core/Scripts/IO/MaterialExporter.cs +++ b/Core/Scripts/IO/MaterialExporter.cs @@ -238,7 +238,7 @@ private glTFMaterial Export_UniUnlit(Material m) } var cullMode = UniUnlit.Utils.GetCullMode(m); - if (cullMode == CullMode.Off) + if (cullMode == UniUnlitCullMode.Off) { material.doubleSided = true; } diff --git a/Core/Scripts/IO/MaterialImporter.cs b/Core/Scripts/IO/MaterialImporter.cs index c7c991f..96f061f 100644 --- a/Core/Scripts/IO/MaterialImporter.cs +++ b/Core/Scripts/IO/MaterialImporter.cs @@ -124,11 +124,11 @@ public virtual Material CreateMaterial(int i, glTFMaterial x) // culling if (x.doubleSided) { - UniUnlit.Utils.SetCullMode(material, CullMode.Off); + UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Off); } else { - UniUnlit.Utils.SetCullMode(material, CullMode.Back); + UniUnlit.Utils.SetCullMode(material, UniUnlit.UniUnlitCullMode.Back); } UniUnlit.Utils.ValidateProperties(material, true); diff --git a/UniUnlit/Editor/UniUnlitEditor.cs b/UniUnlit/Editor/UniUnlitEditor.cs index 78ea36f..afd11b7 100644 --- a/UniUnlit/Editor/UniUnlitEditor.cs +++ b/UniUnlit/Editor/UniUnlitEditor.cs @@ -69,7 +69,7 @@ private void DrawRenderingBox(MaterialEditor materialEditor, Material[] material { ModeChanged(materials, isRenderModeChangedByUser: true); } - if (PopupEnum("Cull Mode", _cullMode, materialEditor)) + if (PopupEnum("Cull Mode", _cullMode, materialEditor)) { ModeChanged(materials, isRenderModeChangedByUser: true); } diff --git a/UniUnlit/Scripts/Utils.cs b/UniUnlit/Scripts/Utils.cs index 59921f3..d32d4f4 100644 --- a/UniUnlit/Scripts/Utils.cs +++ b/UniUnlit/Scripts/Utils.cs @@ -8,7 +8,13 @@ public enum UniUnlitRenderMode Opaque = 0, Cutout = 1, Transparent = 2, - TransparentWithZWrite = 3, + } + + public enum UniUnlitCullMode + { + Off = 0, +// Front = 1, + Back = 2, } public enum UniUnlitVertexColorBlendOp @@ -16,7 +22,7 @@ public enum UniUnlitVertexColorBlendOp None = 0, Multiply = 1, } - + public static class Utils { public const string PropNameMainTex = "_MainTex"; @@ -45,7 +51,7 @@ public static void SetRenderMode(Material material, UniUnlitRenderMode mode) material.SetInt(PropNameBlendMode, (int)mode); } - public static void SetCullMode(Material material, CullMode mode) + public static void SetCullMode(Material material, UniUnlitCullMode mode) { material.SetInt(PropNameCullMode, (int) mode); } @@ -55,9 +61,9 @@ public static UniUnlitRenderMode GetRenderMode(Material material) return (UniUnlitRenderMode)material.GetInt(PropNameBlendMode); } - public static CullMode GetCullMode(Material material) + public static UniUnlitCullMode GetCullMode(Material material) { - return (CullMode)material.GetInt(PropNameCullMode); + return (UniUnlitCullMode)material.GetInt(PropNameCullMode); } /// @@ -106,15 +112,6 @@ private static void SetupBlendMode(Material material, UniUnlitRenderMode renderM SetKeyword(material, KeywordAlphaBlendOn, true); if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.Transparent; break; - case UniUnlitRenderMode.TransparentWithZWrite: - material.SetOverrideTag(TagRenderTypeKey, TagRenderTypeValueTransparent); - material.SetInt(PropNameSrcBlend, (int)BlendMode.SrcAlpha); - material.SetInt(PropNameDstBlend, (int)BlendMode.OneMinusSrcAlpha); - material.SetInt(PropNameZWrite, 1); - SetKeyword(material, KeywordAlphaTestOn, false); - SetKeyword(material, KeywordAlphaBlendOn, true); - if (isRenderModeChangedByUser) material.renderQueue = (int)RenderQueue.AlphaTest + 150; - break; } }