x


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.

more ▼

asked Apr 03 '12 at 06:14 PM

starvar gravatar image

starvar
58 12 17 19

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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. (:

more ▼

answered Apr 03 '12 at 06:31 PM

GutoThomas gravatar image

GutoThomas
593 32 46 47

yeah it is when i look at right now, TY for your time!

Apr 03 '12 at 06:58 PM starvar

How this name would be displayed in different levels?

Dec 20 '12 at 01:36 PM himanshu619
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x204
x143
x36
x16

asked: Apr 03 '12 at 06:14 PM

Seen: 474 times

Last Updated: Dec 20 '12 at 01:36 PM