x


individual letters appear in GUI from a word from array

hi everyone..

here's my problem, how can i make the letters appear in a GUI based on a word?

example : i got a word BOOK, and i want the LETTERS to be SPELT and appear as INDIVIDUALS on each GUI boxes..

so.. by the word BOOK <- from array

it turns to be [B] [O] [O] [K] <- to GUI.Box

any help is appreciated...

and many thanks to those who helped with this...

thanks..

more ▼

asked May 17 '12 at 06:21 AM

zerox911 gravatar image

zerox911
145 13 21 24

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

1 answer: sort voted first

Try something like this:

for(int i = 0; i < wordString.Length; ++i)
{
    GUILayout.Box(wordString[i]);
}
more ▼

answered May 17 '12 at 06:27 AM

syclamoth gravatar image

syclamoth
15k 7 15 80

You know, since strings are basically arrays.

May 17 '12 at 06:27 AM syclamoth

oo...

can you please explain on how the code works.. or.. can you post a sample code..??

either way..

thanks..

May 17 '12 at 06:32 AM zerox911

That was sample code. Or did you need JavaScript? You didn't specify, so I posted in C#, as is my preference.

May 17 '12 at 10:14 AM syclamoth

so as in java script...

its like : for( var i : int = 0 ; i < wordString.Length; i++){ GUILayout.Box(wordString[i]); }

am i right??

k.. the script worked.. only that when i put in the word BALL or some other word to the wordString...

it came out BALL as one word... but i want it to be like this B_A_L_L ... spelling out the word...

can it be done??

May 18 '12 at 02:18 AM zerox911

Yes, that's right- did it all come out as a single box, or in seperate boxes? You can always intersperse them with

GUILayout.Space(10);
May 18 '12 at 02:38 AM syclamoth
(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:

x3815
x59
x40
x10

asked: May 17 '12 at 06:21 AM

Seen: 408 times

Last Updated: May 18 '12 at 06:29 AM