包含此页的版本:
不含此页的版本:
当脚本化对象将销毁时调用此函数。
using UnityEngine; using System.Collections;public class ExampleClass : MonoBehaviour { void OnDestroy() { print("Script was destroyed"); } }
OnDestroy 不能作为协程。