"Endless runner"

Hey guys, Im new here and Im trying to make a racing car game but I need to make the car go upwards always. Like using this code:

void MoveCarOnXAxis()
{
transform.position += new Vector3(Time.deltaTime * XSpeed, 0, 0);
}

But Upwards.
Its a simple thing but as I say Im new at this.

hey, first of all its a wrong thread for that… but anyways if you are trying to go upwards VERTICALLY, you need to use Y axis and attach a rigidbody (if its a 2d game then rigidbody2D)

THIS IS FOR A 2D GAME, for a 3D just change to vector3 and rigidbody.

float maxSpeed = 5.2f;

float move = Input.GetAxis (“Vertically”);
move = 1; //always moving at maxSpeed which is 5.2

rigidbody2D.velocity = newVector2 (rigidbody2D.velocity.x, move * maxSpeed);

not sure if its gonna work as is, but something along those lines