of     1   

SenseiWarrior
#169313603Thursday, July 30, 2015 5:11 AM GMT

I cant use this for some reason, the error is Assets/Scripts/Player.cs(15,14): error CS1624: The body of `Player.Update()' cannot be an iterator block because `void' is not an iterator interface type Code vv using UnityEngine; using System.Collections; public class Player : MonoBehaviour { public float playerSpeed = 10.0f; private bool isJumping = false; // Use this for initialization void Start () { transform.position = new Vector3(0, 1, -5); } // Update is called once per frame void Update () { transform.Translate(Vector3.right * Input.GetAxis("Horizontal") * Time.deltaTime * playerSpeed); if (Input.GetKeyDown ("w") && isJumping==false) { print ("yo"); isJumping = true; for(int i=1;i<=200;i++) { yield return new WaitForEndOfFrame(); transform.Translate(Vector3.up * Input.GetAxis ("Vertical") * Time.deltaTime); if(Input.GetKeyUp("w")) { //break; } } for(int i=200;i>=1;i--) { yield return new WaitForEndOfFrame(); transform.Translate(Vector3.down * Input.GetAxis ("Vertical") * Time.deltaTime); } print ("ayy"); isJumping = false; } } }
Casualist
#169316942Thursday, July 30, 2015 5:54 AM GMT

Unity has their own forums dedicated to this. This belongs there. I'm a bit rusty, but after a cursory glance through pretty sure it's because you've defined Update as void and yet yeild requires you use IEnumerator.

    of     1