Hello people,
I have problem with destroying parent object when my ball hit on child (nothing happens).
This is my code:
void OnCollisionEnter (Collision coll)
{
GameObject hitObject = coll.gameObject;
if (hitObject == “Bad1”) //Bad1 is child of object name Scale (when I write “Scale”, my object is destroyed)
{
Destroy (hitObject);
Destroy (this.gameObject);
}
I hope for yours response.
Thanks,
Kind regards