How can I play a sound every time a particle is emitted?

I know that this was formerly possible with

Code below is not C# but JS-like, now obsolete, Unity Script
function Update ()
{
    if (gameObject.particleEmitter.emit)
    {
        audio.Play();
    }
}

But this doesn’t seem possible anymore with the new particle system. Some have suggested syncing up the sound with the emissionRate but this seems like a sloppy mess if the emissionRate is going to be changed later. Any help would be much appreciated.

I might be 5 years too late here, but in case others find this thread too - here is how I solved playing a sound when a particle is emitted and once it dies:


Hope somebody find it useful.

Enjoy!

Maybe 10 years too late…

To play a sound every time a particle is emitted, you can use the OnParticleTrigger method in your script. This method is called every time a particle is emitted, and you can use it to play a sound. Here is an example:

void OnParticleTrigger()
{
    // Play a sound every time a particle is emitted
    audio.Play();
}

Alternatively, you can use coroutines to manage the playback of the sound and achieve synchronized playback without having to mess with the emission rate.

So I was looking for an answer to this with a looping particle system (Shuriken) and trying to sync audio to a timed interval loop. I was able to get something working - maybe a workaround to not having emit available… this basically plays a one-shot audio at the start of the particle loop… You may have to play with the .1 value - I recently noticed it was playing the sound more than once. Maybe put it in a fixed update loop instead and reduce this to a timed interval… but was able to get a working solution for our game with this method…

Code below is not C# but JS-like, now obsolete, Unity Script
var air : AudioClip;
  
function Update()
{
    if (particleSystem.time <= .1f)
    {
        audio.PlayOneShot(air);
    }
}

I know it was a while ago but did you see this?

Create a script and attach it to the Particle System
The code below worked for me.

ParticleSystem particleSystemRef;
int previousNumberOfParticles;
int currentNumberOfParticle;
[SerializeField] AudioSource emitSound;

void Start()
{
    particleSystemRef = gameObject.GetComponent<ParticleSystem>();
    previousNumberOfParticles = 0;
}

void Update()
{
    int currentNumberOfParticles = particleSystemRef.particleCount;
    if (currentNumberOfParticles > previousNumberOfParticles)
    {
        emitSound.Play();
    }
    previousNumberOfParticles = currentNumberOfParticles;
}