Sorry for bringing back and old post, but I was wondering how to do this for 2 labels on the same panel, there's anyway to difference them?
using UnityEngine;
using System.Collections;
public class ChangeLabelText : MonoBehaviour {
// Use this for initialization
void Start () {
UILabel lbl = GetComponent<UILabel>();
lbl.text = "Hello World!";
}
// Update is called once per frame
void Update () {
UILabel lbl = GetComponent<UILabel>();
lbl.text = "Hello World once again!";
}
}
I'm asking about this part:
UILabel lbl = GetComponent<UILabel>();
Thanks!