Can this be done without scripting? perhaps using a special component or the animation system?
What is the best way of doing this otherwise?
Can this be done without scripting? perhaps using a special component or the animation system?
What is the best way of doing this otherwise?
I created a script that can play a sound on particle birth as well as death. You may need to change the SoundManager.Play line into whatever you use.
@script RequireComponent(AudioSource)
public var OnBirthSound : AudioClip;
public var OnDeathSound : AudioClip;
private var _numberOfParticles : int = 0;
function Update(){
if (!OnBirthSound && !OnDeathSound){ return; }
var count = particleSystem.particleCount;
if (count < _numberOfParticles){ //particle has died
SoundManager.Play(audio, OnDeathSound);
}else if (count > _numberOfParticles){ //particle has been born
SoundManager.Play(audio, OnBirthSound);
}
_numberOfParticles = count;
}