我正在关注 Unity3d 上的“MoveAround”UnityScript 教程。问题是教师编写的代码在将脚本拖放到对象上时工作正常,但是当我这样做时,我收到以下错误消息:
Unknown identifier:
line 14 'Speed' (BCE0005) and
line 15'Curspeed'
代码与教程显示的完全相同:
1
2 var speed = 3.0;
3 var rotateSpeed = 3.0;
4
5 function Update ()
6 {
7 var controller : CharacterController = GetComponent(CharacterController);
8
9 // Rotate around y - axis
10 transform.Rotate(0, Input.GetAxis ("Horizontal")* rotateSpeed, 0);
11
12 // Move forward / backward
13 var forward = transform.TransformDirection(Vector3.forward);
14 var CurSpeed = Speed * Input.GetAxis ("Vertical"); Unknown identifier:'Speed' BCE0005
15 controller.SimpleMove(forward * curspeed); Unknown identifier:'Curspeed' BCE0005
16 }
17
18 @script RequireComponent(CharacterController)