hello, Im trying to create a sound Fx for my character such as walk, idle and jump sound.
here Is my script, not sure what I am doing is correct.
var SoundsEnabled = true;
var Ipin_Walk : AudioClip;
var Ipin_Jump : AudioClip;
var Ipin_Idle : AudioClip;
function Update () {
if(animation.IsPlaying("walk") && SoundsEnabled == true)
{
if(audio.clip != Ipin_Walk)
{
audio.Stop();
audio.clip = Ipin_Walk;
audio.loop = true;
audio.Play();
}
}
if(animation.IsPlaying("jump") && SoundsEnabled == true)
{
if(audio.clip != Ipin_Jump)
{
audio.Stop();
audio.clip = Ipin_Jump;
audio.loop = true;
audio.Play();
}
}
else if(animation.IsPlaying("idle") && SoundsEnabled == true)
{
if(audio.clip != Ipin_Idle)
{
audio.Stop();
audio.clip = Ipin_Idle;
audio.loop = true;
audio.Play();
}
}
}
as for now, my script kindda work. If I jump, walk and idle the sound will play accordingly. But when I started to walk and jump at the same time, my jump sound Fx did not play at all, only silent and when my charater land back on the ground from jumping it will play the walking sound Fx.
Having trouble with my jumping sound.