I have a Ball object with physics applied to it, and it has a sub gameObject (Pickup) with a spherical trigger on it so that you can pick it up when you walk near by.
How do I delete the parent object?
var deleteObj = (gameObject.name != "Pickup") ? gameObject : transform.parent;
Destroy(deleteObj);
I’m getting this error because it’s not a game object. How do I get from the transform to the game object?
“Can’t remove component.
Can’t remove Transform because MeshFilter, SphereCollider, MeshRenderer, Rigidbody depends on it”