unity is giving me an error saying (Assets/FootStepON.js(3,26): UCE0001: ‘;’ expected. Insert a semicolon at the end). here is the script:
if (Input.GetKeyUp (KeyCode.W))
{
audio.clip = FootStepSound1.wav;
audio.Stop();
}
unity is giving me an error saying (Assets/FootStepON.js(3,26): UCE0001: ‘;’ expected. Insert a semicolon at the end). here is the script:
if (Input.GetKeyUp (KeyCode.W))
{
audio.clip = FootStepSound1.wav;
audio.Stop();
}
to add an audio clip you’ll have to write code in following manner
if(Input.GetKeyUp(KeyCode.W))
{
audio.clip = Resources.Load<AudioClip>("path") as AudioClip;
}
it’ll load clip in your audioSource which is named as audio. rest is upto you how you want it to play.