Quick question about destroying bullets/objects

I have this script to shoot a cube, I have it set up so upon hitting the player. Known as wall, it waits one second then destroys itself. What I want to know how to do is edit this code so if it doesn’t collide with the player, or collides with anything else it waits 5 seconds then destroys itself, here’s what I have:


var damage = 5;

function OnCollisionEnter(theCollision : Collision){

 if(theCollision.gameObject.name == "Wall"){

//take 5 points from health of the wall
Player.health -= damage;
yield WaitForSeconds(1.0);

yield WaitForSeconds(5.0);

Thanks ahead of time guys!

Ah, thats an easy one,

function Start()
   Destory(gameobject, 5);

the destroy function has a second parameter you can put in that takes in a float which is in seconds. So when the object starts up, it queues the bullet to get destroyed in 5 seconds, you can also replace the yield with the way i did the destroy function.