I have an audio clip that is set to “play on awake” as a 3D sound. it is about a 15 second clip of a dog whistle that I am using as a bomb whistle for an incoming projectile (the clip is attached to the projectile). I would like the user to only hear the whistle as it gets close to them, then progressively louder until the explosion when it collides.
I have the max distance set to 30 with a linear roll off. The issue: I am hearing the audio clip as soon as the projectile is instantiated, well outside max distance range. There is no roll off effect that I can hear. It is at 100% as soon as it is instantiated (would like it to be 0% until it gets within 30 units).
I have searched and found that others have had the same issue (no answers). Is this a bug or am I just setting this up incorrectly? Is there another way of achieving this effect? Thanks.
in the project panel, select the sound and check “3D sound”. then “apply”
also, be sure min distance is set to something low, like 0
Sorry, didn’t edit in time, my lame internet… The problem was the Pan, it must have been inadvertently set to 0, which will ignore the 3d sound… If it happens again, make sure pan is set higher…
I removed the component and re-added it. It is working correctly now. I previously played with some of the other 3D settings and that seems to have messed it up. The default settings allow the min/max to work as expected.
Setting the Pan Level all the way up (to 1) solved this for me.
You need to do following setting :
GameObject ==> Audio Source ==> Spatial Blend (Drag it from 2D to 3D).
That’s it .
Enjoy…
I had the same issue, and it was because unity was checking the distance to the default camera and not my character camera, so try to uncheck the audio file effect for the rest cameras in your game except one that you will use.