UI: Loading the text in a Text type with a String?

Using the new Unity4.6 UI System;

I’ve got a Text type loaded onto a canvas that I need to update with a string. In attempting to update a text component as follows;

myObject.getComponent<Text>().text = passedString;

I’m sent back an error stating that a String type cannot be implicitly converted to a Text type. Casting passedString manually also doesn’t make any difference.

I’ve found I can actually hack around it with;

myObject.getComponent<Text>().text = "" + passedString;

But this at least, looks like terrible practice.

Could anyone let me know what the correct way of converting a String to a text type is?

Hi,
I don’t think you are doing anything wrong.
Still try this:

using UnityEngine.UI;
public class yourClass : MonoBehaviour
{
	public Text largeAlphabetHighlighter; // Pass this value from inspector..
 void Start()
{
   largeAlphabetHighlighter.text = passedString;
}

}