I,m trying to attach two sounds to my tank model through an audio source
One for idle and one for moving. i have tried to modify a few scripts but cant seem to get any of them work but this one. The problem is it plays the running sound one time
then cuts out. what i want to achieve is one idle sound for when it stops and a running sound for when i press the up key and then stop it when i release it and go back to the idle sound.
var iddle: AudioClip;
var acceleration: AudioClip;
var ralenti: AudioClip;
var rec: AudioClip;
var radio: AudioClip;
function Update() {
if (Input.GetKeyDown (“up”))
audio.PlayOneShot(acceleration);
if (Input.GetKeyUp (“up”))
audio.Pause();
if (Input.GetKeyDown (“down”))
audio.PlayOneShot(rec);
if (Input.GetKeyUp (“down”))
audio.Pause();
if (Input.GetKeyDown (“o”))
audio.PlayOneShot(radio);
}