- Home /
Insert A name?
Hi guys, for my highscore script people should be available to type their name and i don't know how i should probably get like a textbox you can edit in unity. Someone has a script or somthing like that?
ty in advance.
Comment
Best Answer
Answer by GutoThomas · Apr 03, 2012 at 06:31 PM
It's pretty easy, try this code in JavaScript:
var _name: String;
function OnGUI() {
_name = GUI.TextField(Rect(10, 10, 200, 50), _name);
}
or in C#:
private string _name;
void OnGUI() {
_name = GUI.TextField(new Rect(10, 10, 200, 50), _name);
}
In the same time that _name is the variable that hold the value of the TextField, it's the editable value of it. (:
How this name would be displayed in different levels?
Your answer
Follow this Question
Related Questions
How to make a highscore list? 0 Answers
How can i save/load a changing variable in a scene file?(EX:highscore/name) 1 Answer
i want to insert name on character 3 Answers
HighScore Names 1 Answer
Accessing local system ( File Browser ) 2 Answers