Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

Question Audio not working on WebGL builds in any browser

Discussion in 'Audio & Video' started by GrayRabbitGames, Jan 28, 2021.

  1. GrayRabbitGames

    GrayRabbitGames

    Joined:
    Mar 1, 2016
    Posts:
    6
    I'm working on a game for Global GameJam 2021. It's been a long time since I made a WebGL build but this seems the easiest way to share my work.

    The problem is, I cannot get the game's audio to work on any webGL build, on any browser. I've tried running it locally, and also sharing to Play.Unity.Com (here), in Chrome and also Firefox.

    I can hear the sound just fine when I play the game in editor, but not when the game is built. I don't see any audio-related errors in the browser console.

    I've been searching all over the web for answers - I can see that some browsers were having issues playing audio on Unity WebGL, especially if the player hadn't interacted with the page first, but that is definitely not a problem on Play.Unity.Com, which makes you press several buttons before the game starts.

    The sounds are all .WAV files, and they are being played via simple audiosource calls to Play() or .PlayOneShot().

    Does anyone know what could be causing this? Is there something I'm missing?
     
  2. DrShimizu

    DrShimizu

    Joined:
    Apr 13, 2011
    Posts:
    30
    audio works for me. maybe you forgot to unmute. There is a mute button under the player.
     
  3. GrayRabbitGames

    GrayRabbitGames

    Joined:
    Mar 1, 2016
    Posts:
    6
    Thank you for checking! I solved the issue. It turned out that Unity had a bug where audio wouldn't work for WebGL builds on the very specific version of Unity that I was using. I upgraded to a newer version and it fixed the issue.
     
  4. nema007

    nema007

    Joined:
    Jun 4, 2022
    Posts:
    1
    hey , I am facing the same problem , which version was you using to get the bug ?