コガネブログ

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

【Unity】Uncaught undefined - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch.

概要

Uncaught undefined - Exception catching is disabled, 
 this exception cannot be caught.  
Compile with -s DISABLE_EXCEPTION_CATCHING=0 or 
DISABLE_EXCEPTION_CATCHING=2 to catch.

WebGL ビルドしたゲームで例外が発生した時に
ブラウザの Console に上記のエラーメッセージが表示されて
例外を catch できずにゲームが固まってしまう場合、

f:id:baba_s:20210819102825p:plain

Project Settings の「Player > Publishing Settings > Enable Exceptions」を
「None」以外にすると例外を catch できるようになる