Reputation: 17
I'm following a Brackeys tutorial on making a first person game. And I'm makin the character move script and I'm trying to test but I'm getting error
CS1002: ; expected.
Heres my code.
public CharacterController controller;
float x = Input.GetAxis("Horizontal");
float z = Input.GetAxis("Vertical");
Vector3 move = transform right * x * transform forward * z;
controller.Move(move);
Upvotes: 0
Views: 619
Reputation: 15598
You are not using dot operator to access the attributes of transform component of the object. In Unity every attribute or method is accessed by dot operator.
You must convert the move variable declaration like this,
Vector3 move = transform.right * x * transform.forward * z;
Upvotes: 1
Reputation: 328
Vector3 move = transform right * x * transform forward * z;
Should be:
Vector3 move = transform.right * x + transform.forward * z;
Upvotes: 2