ScriptableObject.OnDisable 当禁用

function OnDisable () : void

Description描述

This function is called when the scriptable object goes out of scope

当可编写脚本对象超出范围时调用这个函数。

This is also called when the object is destroyed and can be used for any cleanup code. When scripts are reloaded after compilation has finished, OnDisable will be called, followed by an OnEnable after the script has been loaded.

当物体被销毁也将被调用并且可以使用任何清除代码。当编译完成以后重新加载脚本时,OnDisable将被调用,随后脚本已经加载之后,OnEnable被调用。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnDisable() {
		print("script was removed");
	}
}
function OnDisable () {
	print("script was removed");
}

OnEnable cannot be a co-routine.

OnDisable不能作为一个协同程序。

最后修改:2011年4月11日 Monday 10:48

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。