One way to accomplish this would be to simply have a boolean variable that gets checked before playing the sound and set when the sound plays. Something like this:
bool soundHasPlayed = false;
function OnCollisionEnter(){
if (!soundHasPlayed){
audio.Play();
soundHasPlayed = true;
}
}
↧