Experimental: this API is experimental and might be changed or removed in the future.

AssetImporterEditor.OnDisable

切换到手册
public void OnDisable ();

描述

当编辑器对象超出范围时调用此函数。

当编辑器销毁时也会调用此函数,它可用于任何清理代码。 当编译完成后重新加载脚本时,将调用 OnDisable,并在加载脚本后调用 OnEnable。

using UnityEngine;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;

public class ExampleScript : AssetImporterEditor { public override void OnDisable() { base.OnDisable(); Debug.Log("editor was removed"); } }

OnDisable 不能作为协程。