fix: if only Trail Material is used, it will not be displayed

close #294
pull/310/head
mob-sakai 2024-02-02 03:45:10 +09:00
parent 65da5d35f5
commit f73a6777c4
1 changed files with 3 additions and 6 deletions

View File

@ -328,7 +328,8 @@ namespace Coffee.UIExtensions
// Bake mesh. // Bake mesh.
Profiler.BeginSample("[UIParticleRenderer] Bake Mesh"); Profiler.BeginSample("[UIParticleRenderer] Bake Mesh");
if (_isTrail && _parent.canSimulate && 0 < s_CombineInstances[0].mesh.vertexCount) s_CombineInstances[0].mesh.Clear(false);
if (_isTrail && _parent.canSimulate && 0 < _particleSystem.particleCount)
{ {
#if PS_BAKE_API_V2 #if PS_BAKE_API_V2
_renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, _renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera,
@ -337,7 +338,7 @@ namespace Coffee.UIExtensions
_renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, true); _renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif #endif
} }
else if (_renderer.CanBakeMesh()) else if (!_isTrail && _renderer.CanBakeMesh())
{ {
_particleSystem.ValidateShape(); _particleSystem.ValidateShape();
#if PS_BAKE_API_V2 #if PS_BAKE_API_V2
@ -347,10 +348,6 @@ namespace Coffee.UIExtensions
_renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera, true); _renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif #endif
} }
else
{
s_CombineInstances[0].mesh.Clear(false);
}
// Too many vertices to render. // Too many vertices to render.
if (65535 <= s_CombineInstances[0].mesh.vertexCount) if (65535 <= s_CombineInstances[0].mesh.vertexCount)