From 96bb3630f28682aced3fe7631dd699df053b1e3c Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 17 Apr 2020 19:25:55 +0200 Subject: [PATCH] [unity] Fixed a bug where _STRAIGHT_ALPHA_INPUT shader keyword was not set when default import settings are applied automatically (bool parameter was set, but the keyword would only be added when the Inspector is active). --- .../Spine/Runtime/spine-unity/Utility/MaterialChecks.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/MaterialChecks.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/MaterialChecks.cs index 3d34346d5..ce905ea55 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/MaterialChecks.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Utility/MaterialChecks.cs @@ -38,6 +38,7 @@ namespace Spine.Unity { static readonly int STRAIGHT_ALPHA_PARAM_ID = Shader.PropertyToID("_StraightAlphaInput"); static readonly string ALPHAPREMULTIPLY_ON_KEYWORD = "_ALPHAPREMULTIPLY_ON"; + static readonly string STRAIGHT_ALPHA_KEYWORD = "_STRAIGHT_ALPHA_INPUT"; public static readonly string kPMANotSupportedLinearMessage = "Warning: Premultiply-alpha atlas textures not supported in Linear color space!\n\nPlease\n" @@ -134,6 +135,10 @@ namespace Spine.Unity { public static void EnablePMAAtMaterial (Material material, bool enablePMA) { if (material.HasProperty(STRAIGHT_ALPHA_PARAM_ID)) { material.SetInt(STRAIGHT_ALPHA_PARAM_ID, enablePMA ? 0 : 1); + if (enablePMA) + material.DisableKeyword(STRAIGHT_ALPHA_KEYWORD); + else + material.EnableKeyword(STRAIGHT_ALPHA_KEYWORD); } else { if (enablePMA)