Played sound's pitch gets decreased

Hello unity Community

Somehow, when I play a sound, it’s pitch gets decreased. I’m relatively new to unity (started 2 days ago) and really have no idea why that happens.

So I have a little spaceship that can be moved, when i bump into a wall a “boing” sound is played. When I bump into the wall all the time (like always moving forward to the wall) everything is ok, but if I bump into it wait like a second and bump into it again the pitch gets decreased till its just like 0. But when i print the audios pitch its allways the same.

Heres my code:

using UnityEngine;
using System.Collections;

public class controlSpaceship : MonoBehaviour { 
	
	public float rotationSpeed;
	public float acceleration;
	public AudioClip boing;
	
	/*
        Some other code here
        */
	
	void OnCollisionEnter(){
		//debugging pitch : its allways 1.3
		print (audio.pitch);
		//play sound
		audio.PlayOneShot(this.boing);
	}
}

And when I’m allready writing this post, can somebody help me to make it like play only when its not allready played?

Any help is appreciated.

EDIT: Sorry Guys, BUT SOMEHOW, I didn’t change anything at the code, it works now. I just changed some paramteres on the rigidbody.

Hi BitBender

Yea I had this issue too, I don’t know whether what you’ve done is good for what you want to do, but I fixed my issue by simply going into the AudioSource settings → 3D Sound Settings and changed Pan Level to 0, it worked for me :smile:

Apples