From f004e74965985a645b0c53cb9848392171351152 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Tue, 12 Mar 2019 18:34:11 +0100 Subject: [PATCH] [unity] Fixed Exception in incorrect material setting detection mechanism. Fixes #1305. --- .../Editor/spine-unity/Editor/SpineEditorUtilities.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs index da07e5eb2..b27ddb04b 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/SpineEditorUtilities.cs @@ -277,10 +277,12 @@ namespace Spine.Unity.Editor { string materialPath = texturePath.Substring(0, extensionPos) + "_Material.mat"; Material material = AssetDatabase.LoadAssetAtPath(materialPath); if (material != null) { - int straightAlphaValue = material.GetInt(STRAIGHT_ALPHA_PARAM_ID); - if (straightAlphaValue == 0) { - string materialName = System.IO.Path.GetFileName(materialPath); - Debug.LogWarningFormat("`{0}` and material `{1}` : Incorrect Texture / Material Settings found: It is strongly recommended to disable `Alpha Is Transparency` on `Premultiply alpha` textures.\nAssuming `Premultiply alpha` texture because `Straight Alpha Texture` is disabled at material). (You can disable this warning in `Edit - Preferences - Spine`)", texturePath, materialName); + if (material.HasProperty(STRAIGHT_ALPHA_PARAM_ID)) { + int straightAlphaValue = material.GetInt(STRAIGHT_ALPHA_PARAM_ID); + if (straightAlphaValue == 0) { + string materialName = System.IO.Path.GetFileName(materialPath); + Debug.LogWarningFormat("`{0}` and material `{1}` : Incorrect Texture / Material Settings found: It is strongly recommended to disable `Alpha Is Transparency` on `Premultiply alpha` textures.\nAssuming `Premultiply alpha` texture because `Straight Alpha Texture` is disabled at material). (You can disable this warning in `Edit - Preferences - Spine`)", texturePath, materialName); + } } } }