Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Error cannot be an iterator block

$
0
0
So I ran into this error in my update function and I have no idea what it means, or what happened. It seemed to happen when I added my pause to my if statement. Here's the error... error CS1624: The body of `redical.Update()' cannot be an iterator block because `void' is not an iterator interface type Here's my code void Update () { RaycastHit hit; float distance; float waitTime; waitTime = 3.0f; if (Physics.Raycast (new Ray (CameraFacing.transform.position, CameraFacing.transform.rotation * Vector3.forward), out hit)) { distance = hit.distance; if(hit.collider.gameObject.tag == "found"){ yield return new WaitForSeconds (waitTime); if(hit.collider.gameObject.tag == "found"){ foundObject = hit.collider.gameObject; Destroy(foundObject); //x++; //print(x); } } } else { distance = CameraFacing.farClipPlane * 0.95f; } transform.position = CameraFacing.transform.position + CameraFacing.transform.rotation * Vector3.forward * distance; transform.LookAt (CameraFacing.transform.position); transform.Rotate (0.0f, 180.0f, 0.0f); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>