I have my character slide along a wall kind of like in megaman X and I want it to make an sliding sound effect, the problem is that I can’t make it sound right, this is the code I’m using:
public AudioClip resbaladizo;
void Awake()
{
audio.clip = resbaladizo;
}
void OnCollisionStay (Collision lacolision) {
if(lacolision.gameObject.tag == "Player" && (lacolision.rigidbody.velocity.y<-5 || lacolision.rigidbody.velocity.y>5))
{
audio.Play();
}}
As expected, the sound clip sounds every frame the character is in the wall so the one-second sliding sound effect sounds terrible as it is being re-played every frame. Anybody has a good solution for this? Thanks in advance!