SetExecutionOrder(MonoScript, int)
Sets the execution order for a MonoScript. This method forces Unity to reimport the MonoImporter for the target script.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor
public static void SetExecutionOrder(MonoScript script, int order)
Parameters
Remarks
This is the same execution order that the Script Execution Order Settings window displays.
The default execution order for scripts is 0.
Additional Resources: MonoImporter.GetExecutionOrder.
Examples
using UnityEngine;using UnityEditor;class Example{ [MenuItem("Examples/Set Execution Order for a Script")] public static void SetExecutionOrderForAScript() { var assetPath = "Assets/MyMonoBehaviour.cs"; var monoImporter = AssetImporter.GetAtPath(assetPath) as MonoImporter; MonoImporter.SetExecutionOrder(monoImporter.GetScript(), 100); }}