distance travelled on y axis

Making a game similar to doodle jump, and i would like to make a distance system as the score, but in my app is seems to be going really slow, you have to jump like 1-2 platforms to get to 1, while in doodle jump it takes 1-2 platforms to get to something like 100 -1000
also my current system counts the distance from a point even if the player moved to the side it will add 1 point even although the ball didn’t actually jumped up.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class DistanceSystem : MonoBehaviour {

	public float distance;
	public Transform player;
	public  Text label;
	float distanceTravelled = 0; 
	Vector3 lastPosition;

	void Start () {

		lastPosition = transform.position;

	// Update is called once per frame
	void Update () {

		distanceTravelled += Vector3.Distance(transform.position, lastPosition); 
		lastPosition = transform.position;
		label.text = distanceTravelled.ToString ("F0");



You need the vertical distance only, so you have to make the x and z attributes of Vectors to 0. Before measuring the distance, simply create new variable which are equal to Vector.Up times movement. This’ll make sure that only vertical movement is measured in the Vector3.Distace.

Perhaps this is a better solution brother. You just need to subtract your transforum.postion.z with your first ever position.