You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
3.0.0-preview.21
# [3.0.0-preview.21](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.20...v3.0.0-preview.21) (2020-08-28) ### Bug Fixes * if in the mask, rendering material will be destroyed ([0db40cf](0db40cf160)) * support animatable material property (again) ([cf6ca80](cf6ca80d12))
This commit is contained in:
@@ -26,20 +26,30 @@ namespace Coffee.UIExtensions
|
||||
|
||||
public void UpdateMaterialProperties(Material material, MaterialPropertyBlock mpb)
|
||||
{
|
||||
if (!material.HasProperty(id)) return;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ShaderPropertyType.Color:
|
||||
material.SetColor(id, mpb.GetColor(id));
|
||||
var color = mpb.GetColor(id);
|
||||
if (color != default(Color))
|
||||
material.SetColor(id, color);
|
||||
break;
|
||||
case ShaderPropertyType.Vector:
|
||||
material.SetVector(id, mpb.GetVector(id));
|
||||
var vector = mpb.GetVector(id);
|
||||
if (vector != default(Vector4))
|
||||
material.SetVector(id, vector);
|
||||
break;
|
||||
case ShaderPropertyType.Float:
|
||||
case ShaderPropertyType.Range:
|
||||
material.SetFloat(id, mpb.GetFloat(id));
|
||||
var value = mpb.GetFloat(id);
|
||||
if (value != default(float))
|
||||
material.SetFloat(id, value);
|
||||
break;
|
||||
case ShaderPropertyType.Texture:
|
||||
material.SetTexture(id, mpb.GetTexture(id));
|
||||
var tex = mpb.GetTexture(id);
|
||||
if (tex != default(Texture))
|
||||
material.SetTexture(id, tex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user