Im sorry that im posting this again… But i cant seem to find a way to get this right.'m probably missing something simple :/… I thought I had it right with the help I got last time I posted…
As it is, I have a simple cube set up to be destroyed on Collision with a particle effect as the explosion, but I cant for the life of me get sound to play on the collision… Thank you in advance for the help.
Here is the code Im using:
#pragma strict
var stars : ParticleEmitter;
var Sound : AudioClip;
function OnTriggerEnter (collision : Collider) {
if (collision.gameObject.name == "Player")
{
Instantiate(stars, transform.position, transform.rotation);
audio.PlayOneShot(Sound);
Destroy(gameObject);
}
}