Play footstep sound loop while holding button

I want to play a sound for walking i move my character using button so i tried to script like when i press the button the audio should play but the problem here audio is playing when i single click the button if hold the button audio is only playing when i release the button so please help me i will attach my script to you


You need to play the audio when you press the button down, you start playing it when you release the button.

public void OnMouseDown () {
	    source.clip = walk;
	public  void OnMouseUp() {

The problem seems to be the use of OnMouseUp() method, it is called only when the mouse button is released. You seem to need the OnMouseDrag() functionality. You’d have to check inside the method whether the sound is already being played, to avoid starting the sound every frame, and you should be golden :slight_smile: