void Start() { GameObject a = transform.GetChild(0).gameObject; //getting the child GameObject moneyText = a.GetComponent <Text> (); //getting the Text component moneyText.text = Money.ToString() + " $"; //setting it to Money TC = GameObject.Find("TurrentController").GetComponent <TurrentControl>(); }
void Start() { //Getting the TurrentController GameObject , to access the TurrentControl script temp = GameObject.Find("TurrentController"); TC = temp.GetComponent <TurrentControl>(); Money = GameObject.Find("Money").GetComponent <MoneyController>(); //getting the MoneyController Scipt standard = gameObject.GetComponent <Renderer> ().material.color; }