以下のエラーに対処する
An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
RuntimeError: indirect call to null
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120454]:0x284be46
invoke_viii@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:451606
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[83663]:0x179ec0d
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[83664]:0x179f085
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[90251]:0x19dbfb7
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[93337]:0x1a24367
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120451]:0x284be22
invoke_iiii@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:450972
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[93321]:0x1a233f9
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[1174]:0x10dfc1
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[119700]:0x27f6248
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[115427]:0x2732087
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[95114]:0x1b1b90a
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[95116]:0x1b1b92a
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[115139]:0x2721ad1
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[114836]:0x2700cdf
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[95950]:0x1b71b77
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[95950]:0x1b71beb
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120426]:0x282bca8
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120456]:0x284be5e
unityFramework/_JS_CallAsLongAsNoExceptionsSeen/<@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:28114
_JS_CallAsLongAsNoExceptionsSeen@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:28129
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120425]:0x282742c
@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de line 10 > WebAssembly.instantiate:wasm-function[120456]:0x284be5e
browserIterationFunc@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:231130
callUserCallback@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:184752
runIter@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:186008
Browser_mainLoop_runner@blob:http://localhost:64659/34bdb2ab-5aeb-4ac9-b3f9-50613b40c2de:10:184288
以下対処の選択肢。ひとつずつ試してみてほしい。
ブラウザのキャッシュを削除
各ブラウザの設定からキャッシュを削除する。
強制再読み込み
ブラウザでcrtl + f5を押す
使用するブラウザを変える
Windowsの設定からデフォルトで使用するブラウザを変更する。
Decompressiono Fallbackを設定する
UnityのProjectSettings>Player>Publishing Settings>Decompressiono Fallbackをチェック
Compression FormatをDisabledに設定する
UnityのProjectSettings>Player>Publishing Settings>Compression FormatをDisabledに設定
プロジェクトのパスに日本語が含まれていないを確認する
Buildで指定するパスを日本語が含まれていないフォルダを指定する。
IL2CPPの最適化設定を見直す
UnityのProjectSettings>Player>Publishing Settings>Other SEttings >Optimization>MangagedStrippingLevelをMinamalかLowに設定
それか、最適化されないように
Assetsフォルダにlink.xml作成
最適化したくないアセンブリを指定する
例
<linker>
<assembly fullname="ModernUIAssembly" preserve="all"/>
<assembly fullname="Unity.InputSystem" preserve="all"/>
<assembly fullname="Unity.TextMeshPro" preserve="all"/>
</linker>
開発者ビルドで例外の詳細を確認して対処する
DevelopmentBuildで実行。
ブラウザでF12 Consolから例外の詳細を確認する
私の場合だとUIManagerToggleで例外発生しているとでているのでソフトで確認
UIManagerToggle_UpdateToggle_mAAA41701E95F87891597715112D
6E42475DD2ED4A (http://localhost:56404/Build/ver1.0.0.wasm:wasm-
function[18750]:0x2c41839)
コードのすべては有料のアセットなので乗せることはできないが例外が表示されないようになっていた。
try
{
}
catch ()
{
}
catchはするけどLogにはなにも出ていないという状態。なのでコードを以下に書き換える
catch (Exception e)
{
Debug.LogError("An exception occurred: " + e.ToString());
}
これで例外が表示できる。
それで確認すると
OnLabelとOFFLabelにオブジェクトを設定されてないことが原因だった。以下画像は設定した後の画像。
これでBuildしてみるとブラウザ上で例外もなく正常動くようになった。
結論としては
catch ()
{
}
を使用してUnity上では例外発生していなくてもBuild後ブラウザで動かすと例外発生してうまく起動しないことが原因だった。
参考サイト