Howdy, I have the following script that shoots a “laser” when you hit the space bar, and it works perfectly. I’m trying to change it so the laser shoots automatically every 3 seconds or so, but am not sure where to start. Can anybody give me some pointers?
var laserBeamPrefab : Transform;
function Update ()
{
if(Input.GetButtonDown("Jump"))
{
var laserBeam = Instantiate(laserBeamPrefab, gameObject.Find("spawnPoint").transform.position,Quaternion.identity);
laserBeam.rigidbody.AddForce(Vector3.forward * 100);
}
}