Hi people, im getting this message “Script error: Update() can not be a coroutine.”
i have a vague idea of what it means but i don’t understand how to fix it
if someone could explain this and post a fixed version of the code that would be awesome, the script is for a shooting delay to prevent bullet spamming, thanks in advance
var prefabBullet:Rigidbody;
var shootForce:float;
var shots : int = 0;
var maxShots : int = 8;
var nextFireTime : float;
function Update()
{
if(Input.GetButtonDown("Shoot") && shots < maxShots)
{
var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity);
instanceBullet.rigidbody.AddForce(transform.forward * shootForce);
shots++;
}
else if (shots >= maxShots && Input.GetKeyDown("Shoot"))
{
shots = 0;
}
}
function Start() {
if ( Time.time >= nextFireTime );
{
nextFireTime = Time.time + delay;
}
}