Reputation: 29
I'm following a "MoveAround" UnityScript tutorial on Unity3d. The problem is the code the instructor wrote works fine when he drags and drops the script onto the object, yet when I do the same, I get these errors messages:
Unknown identifier:
line 14 'Speed' (BCE0005) and
line 15'Curspeed'
The code is EXACTLY the same as the tutorial displays:
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)
Upvotes: 2
Views: 282
Reputation: 308001
Case matters in most programming languages. You use speed
in your variable declaration and Speed
later on, those are two different things.
The same applies to CurSpeed
and curspeed
.
Decide on one way to write each one and be consistent (personally I'd suggest speed
and curSpeed
).
Upvotes: 3