Here is my code in Update
function. The object has a box collider.
if (Input.GetMouseButtonDown(0)) {
Ray ray = camera.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit3, 400.0F)) {
wName = hit3.collider.gameObject.name;
Destroy(hit3.collider.gameObject);
}
}
But the box collider is not getting destroyed.
How can I destroy it?
Its working now with code
Destroy(hit3.collider);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With