Im trying to do so, if you for example go in to a room i want a sound to start, so I put a cube ,with “is trigger” checked, to the player to collide with and then the gameobject(cube) destroys so it doesnt play a second time when entering the room. I attach the script to the cube and ofcourse sets the players tag to “Player”. I have always used this script but now, in 4.0 it doesnt work. I think the gameobject destroys before the sounds begin playing so you cant hear the sound
#Script
var sound : AudioClip;
function OnTriggerEnter( hit : Collider )
{
if(hit.gameObject.tag == "Player")
{
Destroy(gameObject);
audio.PlayOneShot(sound);
}
}