コガネブログ

平日更新を目標に Unity や C#、Visual Studio、ReSharper などのゲーム開発アレコレを書いていきます

【Unity】Uncaught (in promise) DOMException: The play method is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.

概要

自動再生はユーザーが承認したとき、サイト別設定で許可したとき、
またはメディアがミュートのときだけ許可されます。 Build.framework.js.gz:3:48743

Uncaught (in promise) DOMException: 
The play method is not allowed by the user agent or the platform 
in the current context, possibly because the user denied permission. 

Unity で WebGL ビルドしたら上記の警告やエラーが発生して
Audio が再生されない現象に遭遇した

上記の記事の対応を行ったら警告もエラーが発生しなくなった