Browse Source

[unity] Added warning message when 'CanvasGroup Compatible' is enabled at the Material but 'Canvas Group Tint Black' is disabled at SkeletonGraphic.

Harald Csaszar 2 years ago
parent
commit
8fb3876396

+ 11 - 1
spine-unity/Assets/Spine/Runtime/spine-unity/Utility/MaterialChecks.cs

@@ -96,7 +96,12 @@ namespace Spine.Unity {
 			"\nWarning: 'Canvas Group Tint Black' is enabled at SkeletonGraphic but not 'CanvasGroup Compatible' at the Material!\n\nPlease\n"
 			+ "a) enable 'CanvasGroup Compatible' at the Material or\n"
 			+ "b) disable 'Canvas Group Tint Black' at the SkeletonGraphic component under 'Advanced'.\n"
-			+ "You may want to duplicate the 'SkeletonGraphicDefault' material and change settings at the duplicate to not affect all instances.";
+			+ "You may want to duplicate the 'SkeletonGraphicTintBlack' material and change settings at the duplicate to not affect all instances.";
+		public static readonly string kCanvasGroupCompatibleDisabledMessage =
+			"\nWarning: 'CanvasGroup Compatible' is enabled at the Material but 'Canvas Group Tint Black' is disabled at SkeletonGraphic!\n\nPlease\n"
+			+ "a) disable 'CanvasGroup Compatible' at the Material or\n"
+			+ "b) enable 'Canvas Group Tint Black' at the SkeletonGraphic component under 'Advanced'.\n"
+			+ "You may want to duplicate the 'SkeletonGraphicTintBlack' material and change settings at the duplicate to not affect all instances.";
 
 		public static bool IsMaterialSetupProblematic (SkeletonRenderer renderer, ref string errorMessage) {
 			var materials = renderer.GetComponent<Renderer>().sharedMaterials;
@@ -152,6 +157,11 @@ namespace Spine.Unity {
 					isProblematic = true;
 					errorMessage += kCanvasGroupCompatibleMessage;
 				}
+				if (settings.tintBlack == true && settings.canvasGroupTintBlack == false
+					&& IsCanvasGroupCompatible(material)) {
+					isProblematic = true;
+					errorMessage += kCanvasGroupCompatibleDisabledMessage;
+				}
 			}
 			return isProblematic;
 		}