Here is my current code:
#pragma strict
var prefabBullet:Rigidbody;
var shootForce:float;
var shootPosition:Transform;
function Update()
{
if(Input.GetButtonDown("Jump"))
{
var instanceBullet = Instantiate(prefabBullet, transform.position, shootPosition.rotation);
instanceBullet.rigidbody.AddForce(shootPosition.right * shootForce);
}}
I would like to add something to this script that would delete the bullet that is shot after 2 seconds.