i have the bullets for a gun destroying after 5 seconds but i want them to destroy when they collide with something
here’s the script so far
#pragma strict
var bullet : GameObject;
function Start () {
}
function Update () {
Destroy(gameObject,5);
}
function OnCollisionEnter(collision : Collision) {
Destroy(gameObject);
}
it destroys after 5 seconds but it does not destroy when it collides with a collider any help on what is wrong with it would be nice