diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index c3c814e..1e10b0d 100755 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -57,6 +57,7 @@ namespace Coffee.UIExtensions private static MaterialPropertyBlock s_Mpb; private static readonly List s_PrevMaskMaterials = new List(); private static readonly List s_PrevModifiedMaterials = new List(); + private static readonly List s_Components = new List(); /// @@ -124,6 +125,11 @@ namespace Coffee.UIExtensions get { return _modifiedMaterials; } } + public override Material materialForRendering + { + get { return canvasRenderer.GetMaterial(0); } + } + public List activeMeshIndices { get { return _activeMeshIndices; } @@ -250,6 +256,7 @@ namespace Coffee.UIExtensions } // + GetComponents(typeof(IMaterialModifier), s_Components); var materialCount = Mathf.Max(8, count); canvasRenderer.materialCount = materialCount; var j = 0; @@ -268,6 +275,8 @@ namespace Coffee.UIExtensions if (activeMeshIndices[index] && 0 < s_TempMaterials.Count) { var mat = GetModifiedMaterial(s_TempMaterials[0], ps.GetTextureForSprite()); + for (var k = 1; k < s_Components.Count; k++) + mat = (s_Components[k] as IMaterialModifier).GetModifiedMaterial(mat); canvasRenderer.SetMaterial(mat, j); UpdateMaterialProperties(r, j); j++; @@ -279,6 +288,8 @@ namespace Coffee.UIExtensions if (activeMeshIndices[index] && 1 < s_TempMaterials.Count) { var mat = GetModifiedMaterial(s_TempMaterials[1], null); + for (var k = 1; k < s_Components.Count; k++) + mat = (s_Components[k] as IMaterialModifier).GetModifiedMaterial(mat); canvasRenderer.SetMaterial(mat, j++); } }