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:
@@ -185,7 +185,7 @@ namespace Coffee.UIParticleExtensions
|
||||
|
||||
internal static class ParticleSystemExtensions
|
||||
{
|
||||
public static void SortForRendering(this List<ParticleSystem> self, Transform transform)
|
||||
public static void SortForRendering(this List<ParticleSystem> self, Transform transform, bool sortByMaterial)
|
||||
{
|
||||
self.Sort((a, b) =>
|
||||
{
|
||||
@@ -200,6 +200,9 @@ namespace Coffee.UIParticleExtensions
|
||||
if (!aMat) return -1;
|
||||
if (!bMat) return 1;
|
||||
|
||||
if (sortByMaterial)
|
||||
return aMat.GetInstanceID() - bMat.GetInstanceID();
|
||||
|
||||
if (aMat.renderQueue != bMat.renderQueue)
|
||||
return aMat.renderQueue - bMat.renderQueue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user