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.
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
_renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera,
@ -337,7 +338,7 @@ namespace Coffee.UIExtensions
_renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif
}
else if (_renderer.CanBakeMesh())
else if (!_isTrail && _renderer.CanBakeMesh())
{
_particleSystem.ValidateShape();
#if PS_BAKE_API_V2
@ -347,10 +348,6 @@ namespace Coffee.UIExtensions
_renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif
}
else
{
s_CombineInstances[0].mesh.Clear(false);
}
// Too many vertices to render.
if (65535 <= s_CombineInstances[0].mesh.vertexCount)