I have this script almost working but I don’t know what could be wrong, I need that when the player gets into the trigger of an object and then clicks on it, a sound gets played. The object is a cube, with a cubecollider with the option Is Trigger activated and my player has the tag Player…What could be wrong?, it doesn’t play…
This is the script:
var shootSound:AudioClip;
function OnTriggerEnter (Col : Collider)
{
if(Col.tag == “Player”)
if(Input.GetKeyDown(KeyCode.Mouse0)){
audio.PlayOneShot(shootSound);
}
}