Im trying to edit two separate text objects from the same script. My script looks like this so far:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class HUD : MonoBehaviour {
Text text;
Text text2;
// Use this for initialization
void Awake () {
text = GetComponent <Text> ();
text2 = GetComponent <Text> ();
}
// Update is called once per frame
void Update () {
text.text = "EXP " + EXP.exp.curExp;
text2.text = "Level " + EXP.exp.curLevel;
}
}
But text2 overwrites text. I need help. I dont want to use two separate scripts to do the same thing.
Thank you, I was indeed overriding it with GetComponent
– jcastaldo13