You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-06-26 08:23:45 +00:00
feat: add fields located outside the Properties block in the shader as Animatable Properties
close #399
This commit is contained in:
@@ -8,11 +8,18 @@ namespace Coffee.UIExtensions
|
||||
{
|
||||
public enum ShaderPropertyType
|
||||
{
|
||||
None = -1,
|
||||
Color,
|
||||
Vector,
|
||||
Float,
|
||||
Range,
|
||||
Texture
|
||||
Texture,
|
||||
Int,
|
||||
|
||||
Matrix = 100,
|
||||
MatrixArray = 101,
|
||||
FloatArray = 102,
|
||||
VectorArray = 103,
|
||||
}
|
||||
|
||||
[SerializeField] private string m_Name = "";
|
||||
@@ -32,7 +39,11 @@ namespace Coffee.UIExtensions
|
||||
|
||||
public void UpdateMaterialProperties(Material material, MaterialPropertyBlock mpb)
|
||||
{
|
||||
#if UNITY_2021_1_OR_NEWER
|
||||
if (!mpb.HasProperty(id)) return;
|
||||
#else
|
||||
if (!material.HasProperty(id)) return;
|
||||
#endif
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -49,6 +60,21 @@ namespace Coffee.UIExtensions
|
||||
case ShaderPropertyType.Texture:
|
||||
material.SetTexture(id, mpb.GetTexture(id));
|
||||
break;
|
||||
case ShaderPropertyType.Int:
|
||||
material.SetInt(id, mpb.GetInt(id));
|
||||
break;
|
||||
case ShaderPropertyType.Matrix:
|
||||
material.SetMatrix(id, mpb.GetMatrix(id));
|
||||
break;
|
||||
case ShaderPropertyType.MatrixArray:
|
||||
material.SetMatrixArray(id, mpb.GetMatrixArray(id));
|
||||
break;
|
||||
case ShaderPropertyType.FloatArray:
|
||||
material.SetFloatArray(id, mpb.GetFloatArray(id));
|
||||
break;
|
||||
case ShaderPropertyType.VectorArray:
|
||||
material.SetVectorArray(id, mpb.GetVectorArray(id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user