Method OnDestroy OnDestroy() This function is called when the MonoBehaviour will be destroyed. See MonoBehaviour. Declaration protected void OnDestroy()