When I move in game, instead of my sound being played in full, it is playing just a few milliseconds on a loop.
Here's my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Footsteps : MonoBehaviour
{
public AudioSource audioSource;
public PlayerMovement pM;
void Start()
{
audioSource.Stop();
}
void Update()
{
PlaySound();
}
public void PlaySound()
{
if (Input.GetKey(KeyCode.W))
{
audioSource.Play();
}
else
{
audioSource.Stop();
}
}
}
Video Example.
Any suggestions would be greatly appreciated!