// Start is called before the first frame update void Start() { float progress; if (tech.GetCost() != 0) { progress = (tech.GetProgress() / tech.GetCost()) * 160; //GetComponentInChildren<UnityEngine.UI.Image>().GetComponent<RectTransform>().sizeDelta = new Vector2(progress, 0); } foreach (UnityEngine.UI.Text textObj in GetComponentsInChildren <UnityEngine.UI.Text>()) { if (textObj.transform.gameObject.name == "ProgressText") { textObj.text = tech.GetProgress() + " / " + tech.GetCost(); } } }