Alright, so I’ve been trying to make a 2D Platformer in Unity. I’ve run into this error that just won’t go away and seems to halt the entire game, making it useless.
Here is my script. It says the error is on line 9. I will bold it out. Keep in mind, I am not an expert with Unity and I need an answer quick because this is a project for my Senior year of High School and I am using the latest version of Unity. (Unity 4.0)
var speed : float = 4.0;
var jumpspeed : float = 8.0;
var gravity : float = 20.0;
private var moveDirection : Vector3 = Vector3.zero;
function Update () {
var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {
moveDirection = Vector3(Input.getAxis(“Horizontal”), 0,0);
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if(Input.GetButton ("Jump")) {
moveDirection.y = jumpspeed;
}
}
moveDirection.y -= gravity * Time.deltatime;
controller.Move(moveDirection * Time.deltatime);
}