Hey! So as it says I have a very simple script for playing a sound via collider trigger. However, when you enter the trigger zone again, the sound doesn’t restart, it plays again but over the already playing sound. I want some way for it to stop its previous playing and restart?
Here is the script:
public class SoundTrigger : MonoBehaviour {
void OnTriggerEnter(Collider coll)
{
if(coll.gameObject.tag == "Player")
audio.PlayOneShot(audio.clip, 1.0f);
}
}
Disclaimer I am an art student and not very proficient in coding.