- Home /
How do i take a string from a gui and show it in the gameworld c#
I have a quick question. I have this line of code setup to where u can input a string into a textfield and i want to take that string and input it over my characters head in the game world, once the hit the enter key. This is the line of code where you can put the string and i have on clue what to do next.
stringToEdit = GUI.TextField(new Rect(Screen.width /60f,Screen.height / 1.05f, 300,20),stringToEdit,25);
Answer by markpdolby · Jul 02, 2013 at 10:02 PM
Use a 3D Text object (you can create one by going to GameObject -> Create Other -> 3D Text), parent this to your player object and then set the text of the 3D text to the string from the GUI
http://docs.unity3d.com/Documentation/Components/class-TextMesh.html http://docs.unity3d.com/Documentation/ScriptReference/TextMesh.html
Your answer
Follow this Question
Related Questions
Problem with makeing text appear on screen 0 Answers
How do i make my chat window save messages and be a scrolling GUI 0 Answers
IF in a GUI 2 Answers
Detect Text in GUI; Print 1 Answer
format text block in GUI.Box 1 Answer