Hey, i’m new in unity and i got a few problems.
I want to change the walk sound activated from key to animation (parent sound to animation once). This is my source code:
#pragma strict
var fwalk : AudioClip;
function Update () {
if (animation["fwalk"].enabled == true){
print("fwalk");
audio.clip = fwalk;
audio.Play();
}
else if (animation["run"].enabled == true){
print("run");
audio.clip = fwalk;
audio.pitch = 2.2;
audio.Play();
}
}
And now the problem. whenever i press the move key on keyboard, there is just no sounds. but after running/walking when i unpress the move key, the walking/running sound playing. Someone know what happend and how to fix this ?