Colliders and Particle Systems

I’m looking for a bit of general advice on how to go about this problem. I am making a 2D game and want to create and explosion effect that only explodes out horizontally, which I have made a particle system for. However, I need that particle system to do damage to the enemies that get hit by the particle system. I’ve read elsewhere that using OnParticleCollision isn’t a good way to go about it, and that it is better to use some sort of collider. Should I include a collider in my particle system prefab and animate it to move out ward, or should I instantiate a separate one and give it velocity in the code?

Both solutions sound like they would work, you should try to consider which solution would be best for your game. Personally, I would prefer an animating collider on the prefab.

Just make sure the collider boundaries match the particle effect fairly closely every time the effect goes off! Nothing makes a player more grumpy than being confused about what damaged them.

I tried the animated collider, but for some reason the collider wouldn’t instantiate with the rest of the particle system, so instead I added in a few lines of code that instantiated the colliders separately from the particle system, and then applied the velocity to them, and it worked great!