- Home /
Question by
MegaUltimateHD · May 19, 2015 at 10:45 AM ·
javascripterrorcoroutine
Coroutine error help
#pragma strict
var theBullet : Rigidbody;
var Speed : int = 20;
var Reloaded : boolean = true;
var Wait : float = 2;
function Start () {
}
function Update () {
if (Input.GetKey(KeyCode.Alpha1)) {
if(Reloaded) {
var clone = Instantiate(theBullet, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection(Vector3(0, 0, Speed));
Destroy (clone.gameObject, 3);
Reloaded = false;
yield WaitForSeconds (Wait);
Reloaded = true;
}
}
help im trying to make a reload function but i keep getting an error Script error (Fire_Bubble): Update() can not be a coroutine. any changers are appreciated
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613195953im_/https://answers.unity.com/themes/thub/images/avi.jpg)