Multiple Audio Sources (69943)

Hello!

I have created a fun little arcade space shooter. Towards the end of the game when about to face the final boss, I have set up a fade in/out setup so it fades out of the game music into the final boss battle music. The issue is that during the fade transition when the music is at its minimal, it also fades out the gameplay sounds. So, I created a secondary audio source that plays the music and the camera plays the gameplay sounds. It works nicely. The musics fades and the gameplay sounds continue on.

But, Im getting a message in the log saying that there are two audio sources; that there should always be 1 audio source…is this a problem? Is there a way around my situation that can keep the music volume and the gameplay volume separate without using two sources?

I hope this makes sense. I didnt post code because I hope my explanation said it all.

Thanks!

1 Answer

1

You can’t have two listeners in a scene (would be like having two microphones hooked up to one speaker.) You can have all the audioSources you like.

It’s probably complaining that a single game object has two audioSources, so it isn’t sure which settings to use. Just put the other audioSource on an empty.

you can not have two audio listeners. you must have one audio listener it's possible what you need is to change to 2D - not 3D - sounds. background music should simply be a 2D sound you can easily set the volume of different sounds. check the doco

This is what is said in the answer. You cannot have two set of ears in your game, so you cannot fade one out and fade the other in as you were doing. Having two audio sources n the same object seems problematic as well. But you can add an empty game Object to your guy, maybe using a trigger when you enter the room so it is there only at the end. Now you have two audio sources on two different objects, you can fade one out and fade the other in without altering any other sources from the scene, only your music.

Youre right. I misread it. My fault. Thanks! Words fine.