- Home /
AudioSource volume inconsistency
Current situation: I have an audio source on the gun holded by the player (first person view). When the player pulls the trigger, I use PlayOneShot to play the gunshot sound. It works.
Problem: When the audio is played, it's volume isn't always the same. When the player is moving, the sound of the gun is stronger.
What I've tried: I have lowered doppler to zero. I have tried setting audiosource's velocityUpdateMode on both possible settings. I have tried changing spatial blend both to 2d and 3d. Zero result.
Clearly I'm doing something wrong, but I can't figure out what. To be sure the volume IS different (and it's not my ears acting strange) I'm using Audacity to check audio output level. Any help would be appreciated. Thank you
Answer by Luuk-Peters · Nov 03, 2020 at 08:34 PM
I have exactly the same problem. I have the following code in Update():
if((DateTime.Now - SFXLastPlayed).Milliseconds > 200 && !aus.isPlaying)
{
aus.Play();
SFXLastPlayed = DateTime.Now;
}
So it just plays a short clip every 200 miliseconds. Fairly regularly I hear an increase in volume without the volume slider changing. I think it is a bug. Hope it gets fixed. If you find a solution I would love to hear what worked for you.