using System.Collections; using System.Collections.Generic; using UnityEngine; public class HUDProgress : MonoBehaviour { public GameObject start; public GameObject end; public BikeManager bikeManager; private Transform tstart; private Transform tend; private GameObject progress; // Use this for initialization void Start () { tstart = start.GetComponent(); tend = end.GetComponent(); progress = new GameObject("Progress"); progress.transform.parent = tstart; progress.transform.localPosition = new Vector3(0, 0, 0); } // Update is called once per frame void Update () { float p = bikeManager.GetProgress(); progress.transform.position = tstart.position * (1 - p) + tend.position * p; } }