gui text is absent in Unity 4.6

I follow this Roll a ball tutorial. According to it, I need to add Gui Text to show score. But it’s absent in Unity 4.6. Should I add Text from UI instead?

If I try this I get error:

MissingComponentException: There is no
‘RectTransform’ attached to the
“Display Text” game object, but a
script is trying to access it.

And I don’t see any labels in UI. What object should I add instead Gui Text?

Got irritated enough to redo the video, enjoy.

Original Answer

I have a bunch of tutorials in my profile that should show you the basics of working with UI Text. There is also a tutorial in the learn section on UI Text.

Couple of things to note

  • Add using UnityEngine.UI at the top of your script
  • Create a Text using the Create → UI menu. This will automatically add the other GameObjects the UI system needs. (Canvas and EventSystem).
  • Change the public variable from GUIText to Text
  • Modify it with the .text property

GUIText is not absent in 4.6. You can add the GUIText component as usual; it’s in the same component menu where it’s always been. It’s only the GameObject+GUIText creation shortcut that is gone.

Create a new empty game object, then click on “add component” in the Inspector window and then type “GUIText” in the search box.
The older gui is hardly legacy, the new one is built on top of it. If you want something to just show a counter on the top of the screen, i’d go with that instead of making a canvas, adding stuff to it all just to show that.

For all who need the answer here it is!!!