Okay, so I am making a custom editor game. There is a variable called “selectedObject”, that stands for the object that is currently selected and ready to be edited.
if (GUI.Button(Rect(135,215,100,20),"Delete")) {
Destroy(selectedObject);
}
And whenever I click the “Delete” button in game mode, to delete the selected object, I get this error…
Can't remove component.
Can't remove Transform because MeshFilter, BoxCollider, MeshRenderer depends on it
Any ideas?