var target : GameObject;
function OnCollisionEnter(collision : Collision) {
// Destroy the object
Destroy (target);
}
This is the script I am using. I am attaching it to an empty game object which is a child of my tank. The purpose of this script is to kill the target of the script when the collider attached to the object the script is connected to hits another collider. It works if I attach this script to my tank and set the target to be the tank, but it doesn’t work when I attach the script to a child of the tank and set the tank as the target.
Can anyone give me a hand? Any help would be appreciated. I hope people can understand my explanation ![]()