Particle and trail system

Particle and trail system


C-sharp Unity Particle Trail

Context

In my game, Colorless Odyssey, at the start, I didn’t know the particle system of Unity existed, so I made my own system for particles that was improved over time to manage the trails too.

Particles

In this context, a particle is a sprite that can have an animation hover time, a speed, a direction, a lifetime, and a color. I have the possibility to attach a light to the particle to make it glow, but it costs a lot of performance.

Trails

My trails are made of Trail Renderers that I can attach to any GameObject while it’s alive, then detach it when the parent is destroyed or disabled. I made this because I used the trails for projectiles, and when a projectile is destroyed, I want to keep the trail for a few seconds to make it disappear smoothly.

How the system works

The ParticleManager create, update and manage all particles and trails in the game using pooling.

I can spawn particles using different types of spawn that I made, common particles usable everywhere, and specific particles like for a debuff or something else.

I use pooling to reuse particles and trails to avoid creating and destroying them each time and update them all in the same loop.

I’ve also made a Particle Generator that can generate particles in a specific area using a lot of parameters like the number of particles, the lifetime, the speed, the direction and the color.

Limitations

It’s way less optimized than the Unity particle system, but at least I can control it as I want.

Conclusion

It was a good experience to make my own system for particles and trails, it’s very helpful, but I need to improve it to make it more optimized and easier to use.

© 2025 Alexis Haldy