public void Destroy() { GameObject go = m_editor.Selection.activeGameObject; GameObject copy = Instantiate(go); copy.name = go.name; Deformer deformer = copy.GetComponent <Deformer>(); Destroy(deformer); m_editor.Undo.BeginRecord(); m_editor.RegisterCreatedObjects(new[] { copy }, true); m_editor.Delete(new[] { go }); m_editor.Undo.EndRecord(); }