I am trying to play an audio clip defined on a audio source component but when I run the following code, nothing happens:
#pragma strict
var audioSource : AudioSource;
function Start () {
audioSource = GetComponent(AudioSource);
audioSource.Play();
}
Two things that I could think of that could be the problem is. First thing is that you forgot to attach the script to the object that the audio source component is attached to. Second thing is that you are using an older version of unity. I have experienced this problem once and it was because I used an older version of unity.