How can I activate a specific Particle Effect on an object that has several of them?

Hello, I’m relatively new to Unity and I’ve been working with particle effects (PE) in a 2D game I’m designing. I’m having trouble with singling out a specific PE to play on an object. I’ve noticed that even if I have different PE’s in different child objects, all of them play, even if I only want a specific one to play. I’m using TriggerParticles();

in the script, but is there a better way to target a specific PE?

I know that I could assign each PE to a different child object and activate/deactivate that object, but that won’t work for the situation I need it in. For example, when an enemy object is hit by the player, a damaged PE plays. But when I R-click on an enemy to talk, I only want the “talk” PE to play, not the damaged PE.

I have another problem situation where a child object is activated and a looping PE will play until that object is deactivated. However, every time the enemy is hit, the looping PE stacks on top of itself, again and again with each hit.

I’d appreciate any advice you could offer on this. Thanks!

The usual Unity way: make a public ParticleSystem variableName; field for each ParticleSystem, drag each one in, write code to use it.

NOTE: you can lock the Inspector icon (upper right corner, tiny lock) if you need it to hold still while you bring up something else in another Inspector window.

Note: you can right click any tab and open a second inspector window. From there, drag the PS you want into each public field slot.

1 Like

Thanks! I’ll try that. I appreciate the help :slight_smile: