我在 Unity 5 中收到此错误消息
错误CS1525:意外符号
insert variable name', expecting
。
using UnityEngine;
using System.Collections;
public class jumpControll : MonoBehaviour
{
public bool jump;
public float jumpHeight;
// Use this for initialization
public IEnumerator jumpUp (float jumpHeight)
{
jumpHeight = 3.0f;
transform.position = new Vector3(transform.position.x,
transform.position.y + jumpHeight, transform.position.z);
}
public IEnumerator jumpDown (float jumpHeight)
{
jumpHeight = 3.0f;
transform.position = new Vector3(transform.position.x,
transform.position.y - jumpHeight, transform.position.z);
}
public IEnumerator jumpTest()
{
jumpUp(float jumpHeight);
yield return new WaitForSeconds(1);
jumpDown(float jumpHeight);
}
// Update is called once per frame
void Update ()
{
jump = Input.GetKey(KeyCode.Space);
if (jump == true)
jumpTest();
}
}