Dynamically add particlefx to objects?

I’ve got an object A that, depending on its “type”, will use a particular particlefx component to emit particles. At the moment, this object hold all particlefx components it may need even though a given instance will only ever use 1 of the particlefx. This is inefficient and can lead to the Particle FX Max Count limit being reached. Of course, I can just increase the limit, but that feels like a bandaid; it does not actually solve the issue of excessive component usage.

Is there a way to dynamically assign a particlefx component to object A? Will I have to create a separate object B for each particlefx and set B’s parent to A at runtime?

Each component, regardless if it is used or not, costs a bit of memory and a tiny bit of processing, but if the component isn’t enabled the processing will really be negligible. How many different particle effects will you have and how many game objects?

No.

That’s not a bad solution actually!

2 Likes