help with some code

using UnityEngine;
using System.Collections;

public class Generate : MonoBehaviour {

public GameObject lightnest;
public float initialDelay;
public float finalDelay;
public float rampDuration;

protected float _delay;
protected float _runTime;
protected float _timeSinceSpawn;
// Use this for initialization
void Start () {
    _delay = initialDelay;
    _runTime = _timeSinceSpawn = 0.0f;

}

// Update is called once per frame
void Update() {

    _runTime += Time.deltaTime;
    _timeSinceSpawn += Time.deltaTime;
    _delay = Mathf.Lerp(initialDelay, finalDelay, _timeSinceSpawn / rampDuration);
    if (_timeSinceSpawn > _delay) Spawn();

}
protected void Spawn()
{
    _timeSinceSpawn = 0.0f;
    Instantiate(lightnest);
}

}

So this is the code which Im using to generate the pipe thingies, but after i generates it, I want to destroy it after its out of screen or any other possible way, maybe after 3 seconds or something and I want this pipe thingies to generate randomly in different sizes you get me ryt just like flappy bird.

Use the following script

using UnityEngine;
using System.Collections;

public class DestroyPipeThingy : MonoBehaviour
{
    // this function is used to dstroy the GameObject after a certain amount of time
    public void DestroyPipeThingyAfterDelay(float delay)
    {
        if (delay > 0)
        {
            StartCoroutine(DestroyPipeAfterDelay(delay));
        }
    }

    IEnumerator DestroyPipeAfterDelay(float delay)
    {
        yield return new WaitForSeconds(delay);
        Destroy(gameObject);
    }

    // this function will destroy the object when it goes off screen
    function OnBecameInvisible()
    {
        Destroy(gameObject);
    }
}

Usage

protected void Spawn()
{
    _timeSinceSpawn = 0.0f;
    GameObject spawnedObject = Instantiate(lightnest);
    spawnedObject.AddComponent<DestroyPipeThingy>();
    
    // if you want to destroy the object after a certain amount of time uncomment the following
    // spawnedObject.DestroyPipeThingyAfterDelay((initialDelay);
}