Figuring out multiple audio in scene

Hello,

I have three game objects. When the player collides with one, a video starts to play. However and normally editor says sth like “multiple audio source, you should need one”. And video plays silent-no sound. How can I make it flowing smoothly? I need all video and sounds.

Platform is PC btw.

If you provide your code and details on how your objects are setup in the editor, we would be better able to assist you. However, in general, if you want an audio clip to play when your player object collides with an obstacle you can put code on the obstacles that checks during collision if it has collided with the player object by using tags, and then if the tag is "player" (or whatever you set it to), then play the audio clip.

@agostevethorne, you are incorrect. You can have as many audio sources in your scene as you want. It is the audio listener that you should have only one of, and it is by default already attached to the main camera.

1 Answer

1

I don’t see any code here that even tries to play an audio clip.

Read up here

http://docs.unity3d.com/Documentation/Components/class-AudioClip.html
http://docs.unity3d.com/Documentation/Components/comp-AudioGroup.html

And watch this video tutorial

http://unity3d.com/learn/tutorials/modules/beginner/audio/lessons/audio-sources-and-listeners

After having done so, try to first do it on your own, then if you are still having problems come back and describe what specific problem you are having.

the video plays the audio. did you read the question or what?

Your question is not very clear, then. Why are you trying to play a different audio from what is already with the video?

I am really shocked when I have seen your comments. It is very clear that I stated my problem is video related. Since my video have also audio, the editor did not like the situation. Because system needs audio listener for each audio source. Hence there are same number of listeners with number of video. At that point please ignore your wisdom and expertise. Long story short; How can I assign each video's audio piece programmatically/on runtime? Thanks in advance.

@Julien.Lynge I have no sound related codes. But I manually added Audio Source to each (three) objects. I dragged and dropped the sound file to the Audio Source and play on awake is checked. I can handle only audio but video makes everything mixed.