I created a Panel, and placed a UILabel it in. Then I created and attached the following code below, when it runs, I can see the color change in the inspector, but the label is not rendered (it disappears). Is this a bug, or am I missing something? if I comment out the setting of the color, the label text changes.
-=-
public class FloatingText : MonoBehaviour
{
public Color TextColor=Color.blue;
public string Text;
private UILabel m_Label;
void Awake()
{
m_Label = GetComponent<UILabel>();
if (m_Label == null)
{
Debug.LogError("Unable to find UILabel for floating text");
}
}
void Start()
{
if (m_Label != null)
{
m_Label.color = TextColor;
m_Label.text = "New Text";
}
}
}