using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TextFromCost : MonoBehaviour { TowerSelector towerSelector; GameStatus gameStatus; Text text; // Use this for initialization void Start () { towerSelector = GetComponentInParent(); text = GetComponent(); gameStatus = GetComponentInParent(); } void Update () { text.text = gameStatus.towerCosts[towerSelector.index].ToString(); } }