Hey there. Having issues with audio source objects at the moment. I'm trying to get sound volume to fall off over distance and it doesn't work with 2D Spatial Blend. Looking it up all the answers are to set the Spatial Blend to 3D. When I do that I get no sound whatsoever.
Looking at the distance graph it gives me, I can see that the listen is close enough to at least hear some noise, but I get nothing. The only solution for me is to switch it back to 2D, which plays the sound at max volume all the time.
No one seems to have the issue where setting spatial blend to 3D turns off the sound entirely. Does anyone know what's up here?
Been messing around for a while now. Adding spread seems to allow for some volume falloff to work, but we're forced to put in a spread which affects how you hear it based on your facing. The UI doesn't really show you how this works so I get wierd situations where I'm facing the source with my right ear and can't hear anything, but when I face it directly I can. I don't think this is really a solution but it might point to the problem?
Answer by LunguM
Feb 17 at 03:26 PM
Hey, I stumbled on your question when I was trying to find a solution for this as well. What I found is that instead of using the slider for Spatial Blend its better to control it yourself with a curve.
For example, in the graph you add a new key (or more) to the green line (Spatial Blend) and twist it so that you have a curve going from a 0 value (2D) to a 1 value (3D) over distance.
I attached a picture to what I did for an explosion. I'm still learning the Audio Source but I think it can give you an idea on how it could help your issue. From a 0 to about 700 distance the explosion can be heard relatively clear / close to the Audio Listener, the farther away it goes after that however the less you hear the sound until you don't hear it anymore.
I hope this helps you and anyone else that stumbles on this question like I did (even though the answer came after 2 months)
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
5 People are following this question.
Can not play a disabled audio source
Can I play multiple positioned audiosources with one game object?
Problem with playing sound on Trigger-Enter
AudioSource and AudioClip. Stop and play drops an error.
Multiple PlayOneShot bug