What is the quickest way to play background music but NOT AS A 3D sound. I want the sound level to stay constant throughout the game while my player roams the world freely.
Set up an audio source on the object with your audio listener. Have that source handle all the music for the game, and it should have a constant volume in all speakers.
You can also set up an audio source somewhere in the world with a rolloff factor of 0. Youâll run into it shifting from speaker to speaker depending on where it is relative to you, though. Could be cool if you attached it to something like an ingame radio or TVâŚ
Can you just import the respective audio files with â3D Soundâ off?
Atatch a streio audio to the main camera, in the same position in the world as the camera. Easy.
Is there a reason that importing the audio file with â3D Soundâ set to âoffâ wouldnât be a viable solution? (There very well may be - just curious, really.)
Even if 3D Sound is off, that doesnât stop it from getting quieter as it gets further away due to the rolloff factor. As a result, it wouldnât help if the audio source wasnât attached to the camera.
It is a solution, yes, but not one thatâs perfect.
Are you sure about that? Have you actually tried it?
I just placed a looping sound in a scene with the first-person controller prefab, and the pan and volume of the sound changed as expected as I moved around. I then re-imported the clip with â3D Soundâ set to off. After that, the sound played at exactly the same volume regardless of where the listener was in the scene - no attenuation whatsoever. (I tried this in both 2.x and 3, and the results were the same.)
So again, are you sure that what youâre saying is correct?
After looking into this a bit more, Iâm thinking your understanding of what the â3D Soundâ option does is likely incorrect.
As I mentioned, I tried this in both Unity 2.6 and Unity 3, and in each case setting â3D Soundâ to âoffâ did in fact disable volume attenuation. What would the point of the â3D Soundâ option be if it didnât disable volume attenuation? To disable pan and/or doppler only? That would seem kind of odd.
So again Iâll ask, have you actually tried this? Is what you posted above based on actual observation?
I know this thread is a bit old, but for future reference this is what i did.
- Make a camera (or use the main camera/ camera you already have setup)
- Add âAudio Listenerâ and âAudio Sourceâ components to the camera
- On the Audio Source component add your music.
The camera can now be the object that can hear the music it plays. The camera will always be at the same spot so you wont have any weird volume issues with distance from the source.
The correct way to play sound that does not relate to a world position is to do what Jesse Anders said multiple times above: Select the sound asset, disable the 3D Sound option and apply the changes.
Having the sound playing at the same position as the camera is just an unnecessary hack and adds complexity where it is not needed.