unexpected token var

Hi I am doing a tornado twins worm game and I am at part 12, I am trying to get my worm to respawn and unity is saying unexpected toeken var here is my code.

var speed = 3.0;
var rotateSpeed = 3.0;
var bullitPrefab : Transform;
private var dead = false;

function OnControllerColliderHit(hit : ControllerColliderHit)
{
    if(hit.gameObject.tag == "fallout")
    {
        dead = true;
    }
}

function Update ()
    var controller : CharacterController  GetComponent(CharacterController);
    transform.Rotate(0, Input.GetAxis ("Horizontal") * rotteSpeed, 0);

    var forward = transform. TransformDirection(Vector3.forward);
    var curSpeed = speed * Input.GetAxis ("vertical");

    Controller.SimpleMove(forward * curSpeed);

    if(Input.GetButtonDown("Jump"))
    {
        var bullit = Instantiate(bullitPrefab,
                                        GameObject.Find("SpawnPoint").transform.position,
                                        Quaternion.identity);
        bullit.rigidbody.AddForce(transform.forward * 2000);
    }

function LateUpdate()
{
    if(dead)
    {
        transform.position = Vector3(0,4,0);
        gameObject.Find("Main Camera").transform.position = Vector3(0,4,-10);
        dead = false;
    }
}

@script RequireComponent (CharacterController)

Looks like you almost got the code formatter working - what you need to do though is select all the text and then hit the code (10101) button

1 Answer

1

Hard to tell without the code formatted properly, but it looks like you need an open brace '{' after Update()

function Update ()
{
  print("Hello, world");
}