0 like 0 dislike

I'm trying to improve performance of my game, and I see in the profiler that


is making a high amount of GC Alloc.


Is this simply due to creating a bunch of particles? How can I reduce this? I'm suspecting it is causing the garbage collector to run too frequently which results in low framerates.

by Lisk (250 points)

1 Answer

0 like 0 dislike
Hi Lisk,

Particles should be handled by the native plugin that does not use C# garbage collection, so particle count should not matter for this.

Which version of Unity and of which version of the plugin are you using? If I remember correctly you are still using PopcornFX v1?
by Paul (8k points)
From what I am seeing in the PKFxRendering.cs and PKFxCamera.cs files of the latest v1 Unity plugin there are not much per-frame allocations.
Does this high amount of allocations happen when instantiating new effects or is this constant?
Hi Paul, thanks for the reply. After a bunch of digging around, I found out that it was a bug in the Unity Profiler where some unrelated code (fog of war, which uses a shader, not popcorn fx) was being logged as PkFxRenderingPlugin in the profiler. It didn't seem to happen when I did a Deep Profile. Once I fixed the fog of war code, the GC Alloc on PkFxRenderingPlugin went away.
Ok, thanks for the update!