From 54098eea56e22abfcd7df17976387c35b64f7b68 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Sat, 23 Feb 2019 21:29:38 +0900 Subject: [PATCH] close #43; Display warning when material does not support Mask --- Scripts/Editor/UIParticleEditor.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Scripts/Editor/UIParticleEditor.cs b/Scripts/Editor/UIParticleEditor.cs index cddc0d4..8afa2e9 100644 --- a/Scripts/Editor/UIParticleEditor.cs +++ b/Scripts/Editor/UIParticleEditor.cs @@ -108,9 +108,34 @@ namespace Coffee.UIExtensions } s_ParticleSystems.Clear (); + if (current.maskable && current.material && current.material.shader) + { + var mat = current.material; + var shader = mat.shader; + foreach (var propName in s_MaskablePropertyNames) + { + if (!mat.HasProperty (propName)) + { + EditorGUILayout.HelpBox (string.Format("Shader {0} doesn't have '{1}' property. This graphic is not maskable.", shader.name, propName), MessageType.Warning); + break; + } + } + } + serializedObject.ApplyModifiedProperties (); } + static readonly List s_MaskablePropertyNames = new List () + { + "_Stencil", + "_StencilComp", + "_StencilOp", + "_StencilWriteMask", + "_StencilReadMask", + "_ColorMask", + }; + + class AnimatedProperty { static readonly List s_ActiveNames = new List ();