fix: crash occurs when too many vertices are rendered

pull/289/head
mob-sakai 2023-08-14 15:33:19 +09:00
parent 52f2ef1f24
commit 723a04d0cf
1 changed files with 20 additions and 7 deletions

View File

@ -276,6 +276,19 @@ namespace Coffee.UIExtensions
{ {
s_CombineInstances[0].mesh.Clear(false); s_CombineInstances[0].mesh.Clear(false);
} }
// Too many vertices to render.
if (65535 <= s_CombineInstances[0].mesh.vertexCount)
{
s_CombineInstances[0].mesh.Clear(false);
UnityEngine.Debug.LogErrorFormat(this,
"Too many vertices to render. index={0}, isTrail={1}, vertexCount={2}(>=65535)",
_index,
_isTrail,
s_CombineInstances[0].mesh.vertexCount
);
s_CombineInstances[0].mesh.Clear(false);
}
Profiler.EndSample(); Profiler.EndSample();
// Combine mesh to transform. ([ParticleSystem local ->] world -> renderer local) // Combine mesh to transform. ([ParticleSystem local ->] world -> renderer local)