What is the proper syntax for destroying and instantiated shot?

I can get the spaceship to shoot with this:

if(Input.GetButtonUp("Fire1"))
		{
			Rigidbody2D shot = Instantiate(projectile, shotPos.position, shotPos.rotation) as Rigidbody2D;
			shot.AddForce(shotPos.up * shotForce);
		}

How do I get that shot to “disappear” if it hasn’t hit anything after 5 seconds?

Thanks.

Destroy() has an optional second parameter indicating a time in the future. So you can do:

  if(Input.GetButtonUp("Fire1"))
     {
         Rigidbody2D shot = Instantiate(projectile, shotPos.position, shotPos.rotation) as Rigidbody2D;
         shot.AddForce(shotPos.up * shotForce);
         Destroy(shot.gameObject, 5.0f);
     }