Help Me With this Java Script it shows me unexpected token

my java script is this

var speed = 3.0;
var rotateSpeed = 3.0;

function update ()
{
    var controller : CharacterController = GetComponant(CharacterController);
    
    // Rotate around Y - axis
    transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
    
    // Move forward / backward
    var forward = transform.TransformDirection(Vector3.forward);
    var curSpeed = speed * input.GetAxis ("Vertical");
    controller.SimpleMove(forward * curSpeed);
}

@script RequireComponant(CharacterController)

What is the exact error message, and what line is it on? You can double click on the error in the Unity console and it will jump to the line. I see a couple of issues:

  • The name of your update function is Update, not update.
  • GetComponant should be GetComponent.
  • RequireComponant should be RequireComponent.

Most programming languages are case sensitive, and all require exact spelling.