I’m running Unity 4.3.1 and just noticed what appears to be a massive memory overhead when using the new ParticleSystem rather than the legacy particle emitter, animator, and renderer components. Using ParticleSystems appears to significantly increase Scene Memory in the profiler.
I just ran a test, building two “particle systems” that display a single snowflake with animating color. One system was created by adding an ellipsoid emitter, animator, and renderer to a game object. The other was created with a single ParticleSystem component on another game object. The two systems result in particles that are visually identical.
I then profiled two scenes, each with 30 instances of one of these test systems.
Here’s the Scene Memory snapshot from the legacy system:
And here’s the snapshot from the scene using ParticleSystems:
Notice nearly a 300k increase in scene memory when using the ParticleSystem objects?
That 300k increase jumps to a 30 meg increase in our actual game which implements many simultaneous “particle systems”.
I haven’t had any luck researching memory overhead of the new ParticleSystem component, so I’m curious if anyone else has knowledge to share…?
Why is there such a massive overhead?
Switching all our particles back to the legacy system will take considerable time, hence I’m hoping that there’s just something I’m overlooking as to the optimization of ParticleSystems.
Particle systems allocate the amount you specify as Max Particles in the particle system. To reduce memory you would cap this amount. If it only spawns a few, don’t allocate the default thousand. 30 x 1000 = 30,000 obviously, so this is going to be 30,000 times Unity - Scripting API: Particle
I haven’t tested this, but it seems logical enough.
with more testing and profiling even a basic particle system with only a few particles set is going to take a lot of memory. much more than expected. we switched some things that we were using particle systems for to fixed animations instead to save some space. be care of using particle systems when you don’t really need to and if you have to use them with lots of instances of them.
Thanks it did help a bit hippocoder. I found out it’s also because the use of mesh vertex based emitters. I guess it has to store that info but I don’t see why it can’t be shared amongst instances. I also noticed a bug where even if you switch the emitter type to a shape based one it still allocates memory for the vertex based emitter. It doesn’t clear that reference on the serialised object. I’ll file a bug for those.