I have a character that whenever its health is below 0.1, he dies and then a sound comes in. The problem is that the sound keeps playing every single frame instead of just once. This is the script.
public float health;
public AudioSource sound;
void Update()
{
if(health < 0.1f)
{
if(!sound.isPlaying)
{
sound.Play();
}
}
}
Thanks!