feat: ignore rendering of particle systems that do not have a SharedMaterial and TrailMaterial
Close #118pull/120/head
parent
44889c8a33
commit
08c4aba8ab
|
@ -164,6 +164,8 @@ namespace Coffee.UIExtensions
|
|||
// No particle to render.
|
||||
var currentPs = particle.particles[i];
|
||||
if (!currentPs || !currentPs.IsAlive() || currentPs.particleCount == 0) continue;
|
||||
var r = currentPs.GetComponent<ParticleSystemRenderer>();
|
||||
if (!r.sharedMaterial && !r.trailMaterial) continue;
|
||||
|
||||
// Calc matrix.
|
||||
Profiler.BeginSample("[UIParticle] Bake Mesh > Calc matrix");
|
||||
|
@ -218,7 +220,6 @@ namespace Coffee.UIExtensions
|
|||
#endif
|
||||
|
||||
// Bake main particles.
|
||||
var r = currentPs.GetComponent<ParticleSystemRenderer>();
|
||||
if (CanBakeMesh(r))
|
||||
{
|
||||
Profiler.BeginSample("[UIParticle] Bake Mesh > Bake Main Particles");
|
||||
|
|
|
@ -194,8 +194,12 @@ namespace Coffee.UIParticleExtensions
|
|||
var bRenderer = b.GetComponent<ParticleSystemRenderer>();
|
||||
|
||||
// Render queue: ascending
|
||||
var aMat = aRenderer.sharedMaterial;
|
||||
var bMat = bRenderer.sharedMaterial;
|
||||
var aMat = aRenderer.sharedMaterial ?? aRenderer.trailMaterial;
|
||||
var bMat = bRenderer.sharedMaterial ?? bRenderer.trailMaterial;
|
||||
if (!aMat && !bMat) return 0;
|
||||
if (!aMat) return -1;
|
||||
if (!bMat) return 1;
|
||||
|
||||
if (aMat.renderQueue != bMat.renderQueue)
|
||||
return aMat.renderQueue - bMat.renderQueue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue