I have an animation event to add a footstep sound for my running animation, but I can’t get the sound to actually play.
public class FootstepAudio : MonoBehaviour {
public AudioSource footsteps;
public Animator anim;
AnimationEvent footstepsEvent;
// Use this for initialization
void Start () {
}
public void PlayFootsteps (){
Debug.Log ("Playing footstep sound!");
audio.Play ();
print (audio.clip.name);
}
}
I have an AudioSource on the same GameObject as this script set up to play the footstep sound. In my Animation window, I have one event set up to play a footstep sound on a footfall. When I try to edit that event, it says Function Not Supported in the drop down beside this script.
The Debug.Log executes, so I know this function is being executed. I just have no idea what’s wrong with it.