Hello i am having some problem with play specific audio sources, For some reason i cannot get them to play, I have tried a number of different things but just can’t crack it,
public AudioSource tankEngine;
public AudioSource tankTracks;
public AudioSource tankIdle;
void Start(){
AudioSource[] audios = GetComponents<AudioSource>();
tankEngine = audios[0];
tankTracks = audios[1];
tankIdle = audios[2];
}
void OnGUI(){
if(CurrentSpeed > 0)
tankEngine.pitch = 0.5f + (CurrentSpeed / maxSpeed);
tankEngine.Play();
}
Everything else works like a charm but except it will not play,
If i remove “tankEngine.Play();” from the script then just enable Play On Awake on the GO Prefab’s AudioSource then it will work fine with the pitch acceleration etc.
I have been trying to get it to play from script so i can then stop the audio once stationary to play a idle audio clip. Any ideas? Thanks.
Edit 1: I am also starting to get a strange buzzing sound when audio is played Google dosn’t help, I am using the correct audio formats, In-fact i have tried every format of audio just to make sure