- Home /
Make dissapear a object after passing some seconds
Hi, I have done a prefab bullet, I use it to make my character shoots against enemies, when it collide with an enemy it hurts it and an explosion occour, but I notified that if it doesn't collide with the enemy the bullet remains on a unkown part of the scene. Can you say me if there is any function to destroy the object passing some seconds? Lot of thanks
Comment
Best Answer
Answer by FLASHDENMARK · May 22, 2011 at 08:27 AM
var lifeTime = 5.0;
function Awake ()
{
Destroy(gameObject, lifeTime);
}
I believe that is how it is done. Put this on your bullet and it should work.
Uhm... think that ins$$anonymous$$d of dissapearing the bullet dissapear the script >__<''
Ups... $$anonymous$$y mistake ;) Should be fixed now.