using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class misslePickup : MonoBehaviour { public Image timeLeftImg; public float time; private float t; // Start is called before the first frame update void Start() { t = time; } // Update is called once per frame void Update() { t -= Time.deltaTime; timeLeftImg.fillAmount = t / time; if (t <= 0) Destroy(gameObject); } }