I have a project that works fine when I build for windows, but doesn't work when I switch platform to WebGL. The [SerializeField] AudioClip variables in the inspector are all 'missing', even after I check 'override for WebGL' convert to AAC. And when I try to link any audio file to an AudioClip within a WebGL build in the inspector, it doesn't seem to work.
How do I get sound to play within WebGL?
To recreate the problem:
- Create a new Script in any recent unity version, then add a [SerializeField] AudioClip x.
- Put that script on a new gameobject and try to link an audio asset to it.
- Don't forget to switch platform to WebGL and check 'override for WebGL' to AAC in the audio import settings, otherwise you will get compiler errors.