- Home /
How to play music/audio
I have a game where you roll a ball around, avoid obstacles, and collect yellow cubes. I was wondering how to create some type of background music and how I would add it in and stuff. All answers are appreciated! Thanks in advance!
Attach an AudioSource
to one of your gameobject, which always stays in scene, like Camera or an Empty Gameobject. Attach your music to that AudioSource and play around with the settings in it.
How do I get the Audio Clip and attach it on there
Answer by iAmAwsum · Nov 05, 2016 at 03:09 PM
https://docs.unity3d.com/Manual/class-AudioSource.html https://docs.unity3d.com/Manual/class-AudioListener.html
You put the AudioListener on your camera and the AudioSource on an Empty GameObject or your ball (Something that wont dissapear too far off your screen).
Okay, now I just need to know how to upload a certain clip onto there so I can put it on the audio.
Drag and drop Audio File (wav, mp3, ogg) into the Assets folder. Then drag and drop the same audio file from in-Editor Assets folder to AudioSource's field "Clip" and tick "Loop" checkbox.
Your answer
Follow this Question
Related Questions
Can not play a disabled audio source 2 Answers
Stereo Mix as Input? 1 Answer
Problem with playing sound on Trigger-Enter 2 Answers
Multi Channel Audio 4 Answers
Audio continuation through two scenes 3 Answers