この関数は MonoBehaviour が破棄されるときに呼び出されます
OnDestroy はアクティブだったゲームオブジェクト上で呼び出されます
function OnDestroy () {
print("Script was destroyed");
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnDestroy() { print("Script was destroyed"); } }
OnDestroy はコルーチンにすることができません。