1

I am working on a unity game, and there is a speaker upstairs in a house playing music. I want the music to get louder as I get closer and quieter as I move further away. I have attached an AudioSource to the object and I have selected force to mono.

I have also set the Rolloff min and max distance to 0.2 and 12. Here is my inspector:

enter image description here

enter image description here

However, for some reason the volume of the music stays the same no matter where I am in the house.

K.Dᴀᴠɪs
  • 9,945
  • 11
  • 33
  • 43
  • Your graph seems wrong to me. Can you use it with it's default one? I recall 3d audio was working fine with that. – Thalthanas Mar 10 '18 at 12:06
  • @Thalthanas I havent actually touched the graph at all. How do I get the default one? this is the default one for me... –  Mar 10 '18 at 12:08
  • Did you check [this](https://answers.unity.com/questions/247511/3d-sound-basics.html) one before? This graph might help – Thalthanas Mar 10 '18 at 12:09
  • @Thalthanas I had seen that yes but i do not know how to make the graph look like this.. –  Mar 10 '18 at 12:11
  • I should mention that the song i am using is one that my friend created. Does it need to be a certain format to work? This is just a normal .wav –  Mar 10 '18 at 12:13
  • Not sure about the format. In [this](https://www.youtube.com/watch?v=p96RDBlNZRM) youtube video, you can see how its adjusted. – Thalthanas Mar 10 '18 at 12:14
  • I watched the video and I can see there is definitely something wrong with my graph as it won’t let me change it at all? Could it be the audio I’m using? –  Mar 10 '18 at 12:25
  • Perhaps the force mono option. Not tinkered with audios before, but you can try switching it into stereo, if that did not worked, try with different audio to see if your current one has problem or not – Thalthanas Mar 10 '18 at 12:31
  • Ive tried all this now and still not able to alter the graph! it's almost shaded grey as if I cant click or change anything –  Mar 10 '18 at 12:44
  • Try to turn "Bypass Effects" off, see if you can alter the graph then. Alternatively try set max distance to 500. – Doh09 Mar 10 '18 at 16:59
  • 1
    Your spatial blend it set to 2D. Make it 3D instead. – Bart Mar 10 '18 at 18:25

1 Answers1

2

In the AudioSource the value of Spatial Blend ist set to 0 (= 2D). This results in a setting used for a 2D game, where an audio simply gets louder if you get closer.

In order to get a 3D sound set it to 1 (= 3D). This enables all you are after.

After doing that you can adjust further how the volume shall falloff with the distance to the object and tweak all the other effects.

derHugo
  • 83,094
  • 9
  • 75
  • 115