Code won't make game object.y go down

Ok i have a big script but i will only give you 1 variable, and 1 function from them

var gravity : float = 20;
private var moveDirection : Vector3 = Vector3.zero;

function chase(){
	moveDirection.y -= gravity * Time.deltaTime;
}

shouldn’t this snippit alone allow the gameobject to go down at a constant rate according to the value of gravity variable. Thing is it doesn’t, so yea

This code doesn’t do anything by itself other than set the value of moveDirection. Somewhere in an Update() loop you need to use moveDirection. If this is a character controller, then it will be in CharacterController.Move(). If this is just a transform, you can do something like:

transform.position += moveDirection;

or:

transform.Translate(moveDirection, Space.World);

It looks like you’re accounting for Time.deltaTime too many times - in both assigning the y component of moveDirection, and then again in the Controller.Move() method. Try just:

moveDirection = transform.forward;
moveDirection *= moveSpeed;
moveDirection.y -= gravity;
controller.Move(moveDirection * Time.deltaTime);