---
title: エラー処理のカスタマイズ
product: Unity Editor
version: '6000.0'
latest_version: '7000.0'
status: This page documents version 6000.0. The latest version is 7000.0.
canonical: https://docs.unity.com/ja-jp/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-error-handling
latest_url: https://docs.unity.com/ja-jp/engine/7000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-error-handling.md
last_updated: 2026-10-30
generated_at: 2026-12-02T17:12:21.231Z
locale: ja-jp
---

# エラー処理のカスタマイズ

> Unity が ウェブ ビルドのエラーを処理する方法をカスタマイズします。

ウェブ ビルドのエラーの処理方法を選択します。

Unity はデフォルトでビルドにいくつかの JavaScript コードを記述し、エラーを処理します。このコードは、サポートされていないプラットフォームで実行しているときに注意メッセージを表示し、ブラウザーからエラーと例外の文字列を解析して既知のエラーを確認し、より包括的なエラーメッセージとともにエラーダイアログをディスプレイします。この処理は、例えば注意メッセージを非表示にしたい場合などにカスタマイズできます。

エラー処理をカスタマイズするには、以下を行います。

1. [ウェブテンプレート](/engine/6000.0/manual/platform-specific/webgl/building-distribution/templates.md)で`index.html`ファイルを開きます。

2. 以下のコードを `var config = {}` オブジェクトのパラメーターとして追加またはコメント解除します。

   ```lang-js
     errorHandler: function(err, url, line) {
       alert("error " + err + " occurred at line " + line);
       // Return 'true' if you handled this error and don't want Unity
       // to process it further, 'false' otherwise.
       return true;
     
   ```

`errorhandler` 関数は、ページが `window.onerror` イベントハンドラーを起動し、同じパラメーターを使用するときに呼び出されます。Unity のデフォルト エラー ハンドラーの実行を抑制するために、エラー ハンドラーがエラーを処理したことを示す`true`をこの関数から返します。`false` を返すと、エラーが Unity のデフォルト エラー ハンドラーに処理されます。

## 追加リソース##additional-resources

* [ブラウザースクリプトとのインタラクション](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting.md)

* [JavaScript プラグインの設定](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-js.md)

* [Unity C# スクリプトからの JavaScript 関数の呼び出し](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-js-to-unity.md)

* [JavaScript から Unity C# スクリプト関数をコール](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-unity-to-js.md)

* [Unity C#スクリプトからC/C++/C#関数をコール](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browsers-c-to-unity.md)

* [Unity C#、JavaScript、および C/C++/C# コード間のコールバックの作成](/engine/6000.0/manual/platform-specific/webgl/develop/interactingwithbrowserscripting/web-interacting-browser-example.md)
