This commit is contained in:
mob-sakai
2022-06-15 09:09:56 +09:00
parent 4fa43eda4b
commit 37d0c4b711
2 changed files with 28 additions and 21 deletions

View File

@@ -71,6 +71,21 @@ namespace Coffee.UIParticleExtensions
public static class ParticleSystemExtensions
{
private static ParticleSystem.Particle[] s_TmpParticles = new ParticleSystem.Particle[2048];
public static ParticleSystem.Particle[] GetParticleArray(int size)
{
if (s_TmpParticles.Length < size)
{
while(s_TmpParticles.Length < size)
{
size = Mathf.NextPowerOfTwo(size);
}
s_TmpParticles = new ParticleSystem.Particle[size];
}
return s_TmpParticles;
}
public static bool CanBakeMesh(this ParticleSystemRenderer self)
{
// #69: Editor crashes when mesh is set to null when `ParticleSystem.RenderMode = Mesh`