Best Practice for handling particle effects?

I’m working on the project where I need to handle some graphic effects, like when you hit something or fire a shot.

So, I was thinking of using event entities like OnHit, OnShot, etc., to trigger these effects. It seemed like a good idea at first, but now I’m not so sure.

Handling particle effect in event based is best practice on ECS?
How do you guys think about this?

Thanks a bunch in advance! :pray:

Unity has their AnimationEvents built into that, where you can tie them to keyframes of your animation. I almost used that. They have something in there called Beaviours, which give you some more control over when to run different scripts. You can make some generic scripts then that play a particle system you have in a field onEnter, or OnExit, things like that. I think there’s more options too. You can likely do something like get the length of the current aniamtion and play your particle system at 50% of the way through it, if you didn’t want to use the keyframe route via events. I don’t really like that it’s string based, so I opt not to use it. Anyway, a few ideas. GL

Also I’d mention that we made a particle system pool which you can ask for certain vfx from anywhere, it’s a singleton. It’s pretty nice. Once they’re done, they go back to the pool automatically.

1 Like

I just took a look DOTS Galaxy sample now and it resembles your method (particle system pool):

  1. Create a singleton manager for graphic processing which holds GraphicsBuffer
  2. In the any place of other logic, AddRequest to the above singleton manager which results in adding to the above GraphicsBuffer
  3. Process all singleton vfx mangers in the VFXSystem

I think I will adopt this method (your system pool).

Thanks for help!

1 Like