- Home /
How can I get my audio files to work for WEBGL build?
As soon as I switch over to WEBGL build all my audio files lose the option to preview, cannot be dragged into an Audioclip box and when I run game no sound plays at all, not in my editor or in the final build. I have tried bringing in .ogg, .wav and .mp3 and they all do the exact same error mentioned above. I see other unity games with sound so I know it must be possible. tried checking "override for WEBGL" in import settings which removes error message but does not fix the problem. Running Unity 2021 but same problem with 2019. Any help greatly appreciated, thanks!!
This might help: https://docs.unity3d.com/Manual/webgl-audio.html
Answer by CrossGuard-Games · Jul 14, 2021 at 08:46 PM
finally got it fixed! I followed the steps in answer below then restarted Unity
And in between restarting I changed my music files open with preference from 'groove music' to 'windows media player' then re-dragged in sound. I figure following steps from above link is what did it but might as well mention the second action as I'm not sure which one fixed it.
Answer by rh_galaxy · Jul 10, 2021 at 08:29 PM
I have a webgl project where sound is working so it should be able to work.
It's like the metadata files are gone or something. Check your folder where you keep the sounds (Assets/Sound). Maybe regenerate the import settings by emptying that folder and copy the sound files there again.
Attaching images from my project and it directly recognize the sound files and build icons for them. Maybe it can help you.
Hey, thanks for taking the time! I tired making a brand new scene and dragging in a fresh audio file in unity 2021, still the same issue. I assume this would have fixed the issue you were mentioning. The only thing I can think of currently is that the computer I'm using is less than adequate for working with Unity. That's really the only thing I can come up with right now. Thanks again for your response though, at least now I feel confident that it can be done XD
Your answer
Follow this Question
Related Questions
Questions about building game 2 Answers
Audio Gets Distorted in Android Build 0 Answers
WebGl build keeps failing 0 Answers
Audio in WEBGL on IOS devices -1 Answers
Single AudioSource "Ran out of virtual channels" WebGL 0 Answers