Hi guys, I’m having a bit of a problem getting a delay to work.
Even though this has been solved in a fair amount of threads already I still couldn’t exactly understand how to solve this.
This is what I have right now:
var prefabBullet:Transform;
var shootforce = 50;
function Update () {
if (Input.GetButton("Shoot"))
{
var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity);
instanceBullet.rigidbody.AddForce(transform.forward * shootforce);
}
}
Now I want to have a delay between each shot, I have read a few times, that yield WaitForSeconds would do the trick, but I couldn’t quite get my head around where to put that into the code to get it working…
Whoever can answer my question gets a beer should I ever meet him…