i have a lazer shooting from my space ship though when i destroy an asteroid i have to name it to destroy it in my code, how do i get the ray cast to destroy on hit to any object with out nameing the object in the destroy code as mutile asteroids will need mutil destroy codes lines
the is as follows
if(hit.rigidbody.gameObject.name == "AsteroidA")
Destroy (gameObject.Find("AsteroidA"));
if(hit.rigidbody.gameObject.name == "AsteroidB")
Destroy (gameObject.Find("AsteroidB"));