- Home /
Having trouble getting text to show up.
How hard can it be to make text show up on a screen? Apparently very hard. I'm probably missing something extremely basic, but I've been searching for a days and I can't figure out what it is.
I'm making a 2D game, working in C#. First I tried using the UI from 4.6. I made a Canvas, and a text as its child. I typed in some test text, but nothing showed up. The canvas and text box were both sized to fit an area at the bottom of the screen. I messed around with text colors and main camera colors to make sure that it wasn't the color making text not show up.
Next I tried the old GUI. I put in this code and put it on an empty in the scene:
using UnityEngine;
using System.Collections;
public class Dialogue : MonoBehaviour {
void OnGUI() {
GUI.Box (new Rect (0, 0, 24, 4), new GUIContent ("Will English text work?"));
}
}
It still does nothing. There isn't anything else in the place where the text is meant to go, so there shouldn't be anything in the way. The rectangle I defined is the bottom quarter of the screen in game-world units.
I have no idea what is wrong. Please help me out. Thank you.
Your answer
Follow this Question
Related Questions
Unity 4.6 adding a Canvas Text onto a gameobject prefab?? -1 Answers
Unity 5 UI Text Glitch (illegible characters) 0 Answers
In-game text editor, native or NGUI 2 Answers
Force Unity UI element to refresh/update? 4 Answers
UI Text changing size? really confused 0 Answers