意外的符号;',期待'' - C#Unity中的错误

时间:2018-03-01 23:18:31

标签: c# unity3d

Helo,我正在使用C#在Unity 3D中构建相机,我不断收到错误消息: Assets / OVR / Scripts / Util / OVRPlayerController.cs(477,59):错误CS1026:意外符号;', expecting)'

这是我的代码:

if (Input.GetKeyUp (KeyCode.L)) {
        oldPosition = transform.position;
        newPosition = transform.position + transform.forward *        lerpDist;
        journeyLength = Vector3.Distance(oldPosition, newPosition);
        startTime = Time.time;
        lerpPosition = true;
    }

    if (lerpPosition) {
        float distCovered = (Time.time - startTime) * lerpSpeed;
        float fracJourney = distCovered / journeyLength;
        transform.position = Vector3.Lerp(oldPosition, newPosition, fracJourney);
        if(Vector3.Distance(transform.position, newPosition) < lerpEnd) lerpPosition = false;
    }
}

1 个答案:

答案 0 :(得分:3)

if(Vector3.Distance(transform.position, newPosition) < lerpEnd) lerpPosition = false;

应该是

if(Vector3.Distance(transform.position, newPosition) < lerpEnd) lerpPosition = false;