left and right 2d walk

Hi I am newer to scripting and I have a question about 2d movement. Originally this script I got from a tornado twins youtube video. I edited it so it would not rotate a character.

#pragma strict

function Start () {

}

var speed : float = 3;

var rotateSpeed : float = 3;

function Update() { var controller : CharacterController = GetComponent( CharacterController );

var forward = transform.TransformDirection( Vector3.forward );

var curSpeed = speed * Input.GetAxis( “Vertical” );

controller.SimpleMove( forward * curSpeed );

}

@script RequireComponent( CharacterController );

The only problem is that I walk with up and down instead of left and right. Is there a solution?

Rotate your character or fix position in modeling program when you are exporting.

Note in unity:

Z is forrward,

Y is up,

X is right.

So when you are moving by calling

Vector3.forward

you will move on Z axis.