Saving a character controller to a variable

I used to know this, but forgot D:

what is used for making a character controller variable, like a transform variable would be?

like var t : Transform
var cc : ???

thanks

How about ‘var cc : CharacterController’? :wink:

Usually you should have a variable declared outside any function, then assign the character controller to it at Start:

var charControl: CharacterController;

function Start(){

  charControl = GetComponent(CharacterController);
}

Now the variable charControl “contains” your character (it actually contains the memory address used to access the CharacterController structure):

  charControl.Move(direction * speed * Time.deltaTime);