Remove unnecessary per-frame allocation.
UIParticle.UpdateRenderers() produces a sizable per-frame allocation due to the use of LINQ's Any() method. Replacing said method usage with a simple foreach loop entirely removes the allocation and reduces over all GC pressure.pull/260/head
parent
a499f0c046
commit
52590b47e4
|
@ -323,9 +323,13 @@ namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
if (!isActiveAndEnabled) return;
|
if (!isActiveAndEnabled) return;
|
||||||
|
|
||||||
if (m_Renderers.Any(x => !x))
|
foreach (var rend in m_Renderers)
|
||||||
{
|
{
|
||||||
RefreshParticles(particles);
|
if (!rend)
|
||||||
|
{
|
||||||
|
RefreshParticles(particles);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bakeCamera = GetBakeCamera();
|
var bakeCamera = GetBakeCamera();
|
||||||
|
|
Loading…
Reference in New Issue