- Home /
How can somebody make text actually appear on the screen with a script
This is what I have sofar
private var text : String = String.Empty;
function Narrative() { text = "Private what are you doing? ... (cut out)"; yield WaitForSeconds(2.5f); text = String.Empty; yield WaitForSeconds(0.5f);
text = "Private, you're on your own ... (cut out)";
yield WaitForSeconds(3.5f);
text = String.Empty;
yield WaitForSeconds(0.5f);
}
function OnGUI() { if (GUILayout.Button("Start Narrative")) { StartCoroutine("Narrative"); } GUILayout.Label(text); }
Now how do I actually put it onto the screen?
Answer by Jason B · Dec 29, 2010 at 07:16 PM
My answer is a little simple, so sorry if I'm just confused or misunderstood the question, but you should use a GUI Text object or something similar, or else your string isn't going to "print" on anything on-screen.
O$$anonymous$$G THAT'S RIGHT, The answer is so simple Lolz thx O$$anonymous$$G! :D
Answer by 3dDude · Dec 29, 2010 at 07:02 PM
Well I'm not really sure what your doing there, but I don't see you calling the function Narrative anyware
other then that The script has be attached to a object in the scene. It wont work without being attached to something or other.
He's starting Narrative as a coroutine when the "Start Narrative" button is pressed. (StartCoroutine can take a method name as a parameter.)
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Whats a good technique to create an in-game screen or display for text output? 1 Answer
what is the correct way to display text on screen 1 Answer
HELP with scripting where GUI is involved 2 Answers
Limit on GUI Components? 0 Answers