Rigth wat to playing a bg music

Hi, i am having some problems on a very basic task: playing a background music.I both created an empty object and attached to it the Audio Source component; futhermore I set its parameters like on the following image:


:roll_eyes:

And what exactly would those problems be? Under which conditions do they occur?

What format is the music file? Music should be a streaming format like mp3 or ogg. If you build for web check the Web Audio caveats and limitations.

1 Like

First, your bg music is hundreds of meters away at (635, 7, 0).

This matters because you did not check (X) Bypass Listener Effects.

Unless your AudioListener is way out near it, you’ll hear nothing.

Generally for bg music, check Bypass Listener Effects.

And generally put everything at (0,0,0) to be tidy.

i put the audio source in my canvas or scene control gameobject. idk what problem is but idk if thats gonna work, im not putting my mp3 in audio generator, instead i put in scene control and then i play it using script by taking reference of audio source, and it works

Mmm, I end up to add in the scene a game object like this:


But I cannot listen the music… :thinking:

Standard debugging… check your audio cables, listen to the song as a preview in Unity, check if Unity is muted, check master volume, etc. etc etc

Oh, I found the problem… somehow I deleted from Mai Camera the Audio Listener component… :face_with_peeking_eye: