fix: when `UIParticlrRenderer` destroy manually, an error will occur
parent
550d0c43be
commit
a11d2d01ce
|
@ -2,6 +2,7 @@
|
||||||
#define SERIALIZE_FIELD_MASKABLE
|
#define SERIALIZE_FIELD_MASKABLE
|
||||||
#endif
|
#endif
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Coffee.UIParticleExtensions;
|
using Coffee.UIParticleExtensions;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
@ -322,9 +323,15 @@ namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
if (!isActiveAndEnabled) return;
|
if (!isActiveAndEnabled) return;
|
||||||
|
|
||||||
|
if (m_Renderers.Any(x => !x))
|
||||||
|
{
|
||||||
|
RefreshParticles(particles);
|
||||||
|
}
|
||||||
|
|
||||||
var bakeCamera = GetBakeCamera();
|
var bakeCamera = GetBakeCamera();
|
||||||
for (var i = 0; i < m_Renderers.Count; i++)
|
for (var i = 0; i < m_Renderers.Count; i++)
|
||||||
{
|
{
|
||||||
|
if (!m_Renderers[i]) continue;
|
||||||
m_Renderers[i].UpdateMesh(bakeCamera);
|
m_Renderers[i].UpdateMesh(bakeCamera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +340,7 @@ namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_Renderers.Count; i++)
|
for (var i = 0; i < m_Renderers.Count; i++)
|
||||||
{
|
{
|
||||||
|
if (!m_Renderers[i]) continue;
|
||||||
m_Renderers[i].UpdateParticleCount();
|
m_Renderers[i].UpdateParticleCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,6 +426,10 @@ namespace Coffee.UIExtensions
|
||||||
{
|
{
|
||||||
m_Renderers.Add(UIParticleRenderer.AddRenderer(this, index));
|
m_Renderers.Add(UIParticleRenderer.AddRenderer(this, index));
|
||||||
}
|
}
|
||||||
|
if (!m_Renderers[index])
|
||||||
|
{
|
||||||
|
m_Renderers[index] = UIParticleRenderer.AddRenderer(this, index);
|
||||||
|
}
|
||||||
return m_Renderers[index];
|
return m_Renderers[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue