I Am currently testing out my indie game I’m developing, but i have a problem. I can get my FootSteps Sound Effect To Work For Some Reason. Here Is The Script:
var AudioFile : AudioClip;
function Update() {
if (Input.GetKeyDown (KeyCode.W))
{
audio.clip = AudioFile;
audio.Play();
}
}
Is It The Script That I Put in the first person controller, or did i just do EVERYTHING wrong, btw the sound effect is a .mp3 if thats helpful to know.
Your code will play the audio just once when you press W; it is not a desired effect for footstep sound effect. Take a look at these 2 scripts written by @alucardj, [Footstep audio script with delay][1] and [Simple Footstep audio script][2]. Run the script, understand the logic, and make the necessary modifications to make it work with your game. [1]: http://answers.unity3d.com/questions/373508/footsteps-script-for-running-and-walking.html [2]: http://answers.unity3d.com/questions/343383/switch-between-two-different-sounds-for-walking-an.html
– Chronos-LWhat was wrong before this?
– Chronos-L