You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
feat: shrink rendering by material
NOTE: Performance will be improved, but in some cases the rendering is not correct. Close #113
This commit is contained in:
@@ -41,6 +41,9 @@ namespace Coffee.UIExtensions
|
||||
[Tooltip("Particles")] [SerializeField]
|
||||
private List<ParticleSystem> m_Particles = new List<ParticleSystem>();
|
||||
|
||||
[Tooltip("Shrink rendering by material on refresh.\nNOTE: Performance will be improved, but in some cases the rendering is not correct.")] [SerializeField]
|
||||
bool m_ShrinkByMaterial = false;
|
||||
|
||||
#if !SERIALIZE_FIELD_MASKABLE
|
||||
[SerializeField] private bool m_Maskable = true;
|
||||
#endif
|
||||
@@ -81,6 +84,17 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
}
|
||||
|
||||
public bool shrinkByMaterial
|
||||
{
|
||||
get { return m_ShrinkByMaterial; }
|
||||
set
|
||||
{
|
||||
if (m_ShrinkByMaterial == value) return;
|
||||
m_ShrinkByMaterial = value;
|
||||
RefreshParticles();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Particle effect scale.
|
||||
/// </summary>
|
||||
@@ -217,7 +231,7 @@ namespace Coffee.UIExtensions
|
||||
}
|
||||
|
||||
particles.Exec(p => p.GetComponent<ParticleSystemRenderer>().enabled = !enabled);
|
||||
particles.SortForRendering(transform);
|
||||
particles.SortForRendering(transform, m_ShrinkByMaterial);
|
||||
|
||||
SetMaterialDirty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user