---
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/scripting/object-oriented-development/managing-update-order/script-execution-order
latest_url: https://docs.unity.com/ja-jp/engine/7000.0/manual/scripting/object-oriented-development/managing-update-order/script-execution-order.md
generated_at: 2026-11-14T04:36:57.546Z
locale: ja-jp
---

# スクリプト実行順序

> Unity が個々の MonoBehaviour スクリプトの実行にどのように優先順位を付けるかを説明します。

[スクリプト内の](/engine/6000.0/manual/scripting/object-oriented-development/managing-update-order/execution-order.md)関数の実行順序に加えて、アプリケーションに関するもう 1 つの重要な考慮事項は、Unity が異なるスクリプト コンポーネントを実行する順序です。例えば、`EngineBehaviour` と `SteeringBehaviour` の 2 つのスクリプトがある場合、`EngineBehaviour` が常に`SteeringBehaviour`の前に更新されるようにします。

スクリプトの実行順序は以下のように設定できます。

* Unity エディターで、Editor ウィンドウの [**Script Execution Order**](/engine/6000.0/manual/unity-editor/editor-settings-reference/comp-manager-group/class-mono-manager.md) (スクリプト実行順序) 設定を使用します。
* コードでは、MonoBehaviour から派生したクラスに [`[DefaultExecutionOrder]`](/engine/6000.0/script-reference/unityengine/defaultexecutionorder.md) 属性を適用します。

## 重要な考慮事項と制限事項##important-considerations-and-limitations

* [`[DefaultExecutionOrder]`](/engine/6000.0/script-reference/unityengine/defaultexecutionorder.md) を含むコードで定義された実行順序は、[**スクリプト実行順序**](/engine/6000.0/manual/unity-editor/editor-settings-reference/comp-manager-group/class-mono-manager.md)設定ウィンドウに表示されません。MonoBehaviour から派生した型の実行順序を `[DefaultExecutionOrder]` を持つコードで定義し、同じ型に異なる値をエディターのプロジェクト設定ウィンドウで定義すると、Unity はエディター UI で定義された値を使用します。

* 同じスクリプトの複数のインスタンスを異なる GameObjects に割り当てると、実行順序の値が低いスクリプトのすべてのインスタンスが、どのゲームオブジェクトに接続されているかに関係なく、実行順序の値が高いスクリプトのすべてのインスタンスよりも先に実行されます。

* 複数のシーンを[追加でロード](/engine/6000.0/script-reference/unityengine/scenemanagement/loadscenemode/additive.md)する場合、設定されたスクリプト実行順序は、シーン間の一部ではなく、一度に 1 つのシーン全体に適用されます。前述の `SteeringBehaviour` スクリプトの前に実行するように設定された `EngineBehaviour` スクリプトの例では、両方とも 1 つのシーンで更新されてから次のシーンで更新されます。

* 複数のスクリプトに同じ設定済み実行順序またはデフォルトの実行順序がある場合、それらのスクリプト間の実行順序は決定論的ではありません。テスト中は順序に一貫性があるように見えるかもしれませんが、この動作はビルド、マシン、または Unity バージョン間で保証されていないため、当てにしないでください。詳細については、[イベント機能実行順](/engine/6000.0/manual/scripting/object-oriented-development/managing-update-order/execution-order.md)を参照してください。

* **スクリプト実行順序**設定ウィンドウで指定された実行順序は、以下には影響しません。

  * [`[RuntimeInitializeOnLoadMethod]`](/engine/6000.0/script-reference/unityengine/runtimeinitializeonloadmethodattribute.md) 属性でマークされた関数の順序。
  * [`OnDisable`](/engine/6000.0/script-reference/unityengine/monobehaviour/ondisable.md) と [`OnDestroy`](/engine/6000.0/script-reference/unityengine/monobehaviour/ondestroy.md) 関数

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

* [イベント機能実行順序](/engine/6000.0/manual/scripting/object-oriented-development/managing-update-order/execution-order.md)
* API リファレンス
