Tilevainia sound by distance

So I’m working on tilevainia & I managed to get footstep sounds on the mobs when they walk. My issue is that I can hear every mob in the scene walking & there’s no sound distance to player ratio. I tried using Spatial Blend but I’m not getting anywhere. Is there someone who can assist with this?

The spatial distance is the way to go, but there’s a catch: it works based on the distance to the audio listener. By default, an audio listener is added to the camera. You may want to remove it from the camera, and add it to your player game object instead. This will then manage the audio based on the distance to the player.

I don’t see where or how I’m supposed to add “spatial distance”.

OHh I did find spatial sound (not a check off box but a slider) & put the sound sources on the player but I hear no difference.

You have to put the audio listener on the player. The sources go on whatever is making the sound

I put the audio listener on the player & adjusted the spatial on the sounds (mobs walking) but I noticed no difference in the sound from when the camera had the audio listener on it. I watched some videos & it seems to be simple but not working for me.

Did you change the Spatial Blend to 3D? It should be towards the 3D side of the slider

Change the spaital blend to 3d?
I adjusted 3d parameters.

Could you please share a screenshot of the result, so we know that you did what we think you did? It is easy to misunderstand each other.

IDK if those help.

They do help as we now can see what you have in Unity. The Diphlo has got an AudioSource component, and that AudioSource component is set to 3D. That’s exactly what you need.

Theoretically, your idea should be working but it might be that the Diphlo is too close to the camera. Maybe try to set the MaxDistance in the Aduio Source to 10 to see if that affects the volume. Also try to set the “Volume Rolloff” to “Linear Rolloff”.

Also see here: Unity - Manual: Audio Source

Ty Nina, you know this is supposed to be Tile-Vainia 2021 released Oct-Nov 2021 but…

From the basic understanding, you’ve done this spacial to make the sound 3d.

Out of interest, where is the audio listener?

Where are the audio sources?

Yeah, I can’t see where the player is. As I mentioned earlier, the Audio Listener must be on the player in this type of game, because the camera is basically similar distances from everything, so you want the Audio Listener to be on the player so that that distance is used instead of the distance to the camera

That was my thought of what might be happening.

Oh, isn’t the car supposed to be the player?

The AudioListener is usually on the MainCamera game object. And the camera usually looks at the player. Maybe it helps to imagine that you are the camera. Your ears and eyes are that camera.

Any 3D sound is played relative to the AudioListener, not to the player.

you know this is supposed to be Tile-Vainia 2021 released Oct-Nov 2021 but…

But? The AudioSource and AudioListener have been the same for many, many years. If you noticed any difference or if something does not work, please provide more information.


See also:

I believe he’s expanding on the tilevania project.

That’s what I figured. “Sound by distance” should be working out of the box. I remember that quite a few students complained in old versions of this course because the volume of some sounds was “too low” depending on the distance from the player (actually, the AudioListener on the camera). They didn’t like that. However, from what I understood, that’s exactly what David tries to achieve.