3D Audio not working on WebGL

I’m a beginner trying to learn Unity. I am currently doing the Unity Essentials pathway.

After uploading my WebGL project to Unity Play, I’ve noticed that the 3D audio is not working as intended. The audio just plays as if it is 2D.

It runs fine when testing the project in the Unity Editor. I’ve also tried building the project as an .exe and it also runs as intended there. However, these issues only arise when testing the game on the Unity Play website. Is there any solution to this?

2 Likes

There was an issue which was fixed, make sure you’re using a Unity version newer than one of the ones mentioned under “fixed in” (eg is should work in an 2022.3 version): Unity Issue Tracker - On WebGL Player spatial audio (3D Sound Settings) does not change direction from where the sound is played

If the audio source is the videoplayer: 3d sound is not supported.

There was an issue which was fixed, make sure you’re using a Unity version newer than one of the ones mentioned under “fixed in” (eg is should work in an 2022.3 version): Unity Issue Tracker - On WebGL Player spatial audio (3D Sound Settings) does not change direction from where the sound is played

If the audio source is the videoplayer: 3d sound is not supported.

I’m facing the same issue while learning publishing during the Unity Essentials course. None of the audio sources are videoplayers.

Unity version: 6000.0.27f1
Platform: Linux
Building for: WebGL

1 Like

Same here.

Unity version: 6000.0.33f1
Platform: Windows
Building for: WebGL

Same here. v.6000.0.36f1

(edit: there’s a short explanation here: Audio is not behaving as 3d in WebGL . This seems like an important drawback to using Unity for webGL development. Hopefully there will be a fix for this someday…

It seems that other devs only have issues with spatial audio on VideoPlayer objects, but not on other audio sources… I have this issue with the 3D audio on the Unity Essentials tutorial in the Kitchen Audio scene, on the webGL build.)

Edit: This is about an older version of Unity, but it seems that AudioMixer features aren’t supported: Unity - Manual: Using Audio In WebGL . This could explain the issues with the tutorial scene. (if someone could confirm this, let us know please)
Here are some tips about implementing spatial audio in webGL: Mixing positional audio and WebGL  |  Articles  |  web.dev .
Just a bit strange that the (basic) audio tutorial doesn’t really work in webGL. It would be nice to have a notice about this on the tutorial pages…

2 Likes

I’m having the exact same issue with the kitchen audio scene from the Unity Essentials tutorial. Just so you know it’s not just you…

1 Like

Same here. I’m doing the Unity Essentials tutorial and I just published to WebGL and noticed that the spatial audio doesn’t work in the kitchen scene.

Unity 6000.0.27f1
Windows
WebGL

Hi,

Can you tell me what browser you are using? Positional audio should work on the Web.
I recently tested it on Windows with Chrome and it worked there.

Hello,
I’m using Firefox normally, but the problem is the same in Chrome here. (off topic: very low FPS in Chrome on top of that ; )

(link to demo: Unity Play | Unity Essentials Tutorial game
The ‘kitchen - audio’ scene.)

Hi, it doesn’t work in Chrome, Firefox or Edge. Maybe it has to do with how it’s implemented in the tutorial? It’s the Audio Essentials portion of the Unity Essentials pathway below.

1 Like

I’m having the same issue (6000.0.41f1), tested using Firefox and Edge - positional audio works in a Windows build and when playing in-editor.

Same issue too on Unity 6000.0.25f1
Windows Build and Editor versions plays fine but on the Web build it does not work the 3D spatialization of the Video Player’s linked Audio Source