Problem:-
I have a Traffic system in my game I want to destroy a car that gets hit by another car. But the problem is both cars have the same script with the name TrafficCar. Here is the function inside the script which is responsible for the collision.
void OnCollisionEnter (Collision col)
{
// I want to destroy car after 1 sec due to some reason
if (col.gameObject.tag == gameObject.tag)
Destroy (col.gameObject,1f); // or let suppose I'm using traffic pooling
}
In this case, both cars are destroyed. But I want to destroy the car which gets hits
Question:-
How I can destroy cars that get hits?
For example:- Car A hits Car B then Car B should be destroyed
Thanks In Advance
