destroying a prefab bullet after time

I am making a game of Battleship, and I came across a problem, I created a script so that the ship can fire projectiles, but it happens that whenever a projectile shooting, I create a clone of the prefab I’m shooting.

So I created a script so that after some time he was self distruted. but I’m having a little problem: he destroy the point where the projectile firing, not the “bullet”!
anyone have any idea how I can only destroy the prefab I’m shooting?
this is my scpript:

var lifetime = 1.0;

function Awake () {

Destroy(gameObject.Find(“bufabola(Clone)”).lifetime);

}

Hi,

Firstly I would make a small script that is to be added to the original prefab. Then you can call “this” like so:

var lifetime = 1.0;

    function Awake()
    {
        Destroy(this, lifetime);
    }

This should work so long as the script is attached to the prefab.

instantiating and destroying objects is very heavy, you should try to SetRecusivelyFalse your object that you want to delete, and then push them in a array to reuse them later.

tanks guyz! it is working! :smiley: next stept create an explosion when colliding with the other boats and then sink slowly. wish me luck!

and again tanks a lot! :smiley: