Question by
James510 · Jan 06, 2017 at 08:06 AM ·
optimizationparticlesystemlag
Lag Spike using Particle System Emit
I'm using the latest Unity 5.5, whenever the objects in my scene emit particles, they cause massive lag spikes. The profiler says that it's the ParticleSystem.emit and Particle System Update causing it, so I tried circumventing it by instead setting the game object on and off when using it, but to no avail. The ParticleSystems in the scene are fairly simple, and the amount emitted isn't too high (about 10 a second, 8 total emitters in all). It's a relatively new issue too, the scene used to be able to handle hundreds of complex emitters smoothly, but now even a few will kill the framerate.
Here are some screenshots of the profiler
The code regarding the turretscript emit is
for (int i = 0; i < barrels.Count; i++)
{
if (Time.time > nextFire && ammo > 0)
{
barrels[i].Emit(bulletsPerShot);
ammo--;
nextFire = fireRate + Time.time;
}
}
Any ideas or help would be appreciated, thanks.
ss2017-01-06at015710.png
(151.7 kB)
ss2017-01-06at014732.png
(93.6 kB)
Comment