x


Find Width of Strings for GUILayout.Lablel?

Is there any way to find out how big a string will be on screen.

I want to know how large I have to create my rect for GUILayout.BeginArea();

Thanks, stringa

more ▼

asked Oct 07 '10 at 10:30 PM

stringa gravatar image

stringa
257 37 39 42

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

2 answers: sort voted first

You'll want to use this:

var textDimensions = GUI.skin.label.CalcSize(new GUIContent("text"));

And textDimensions.x will give you your text width.

more ▼

answered Oct 08 '10 at 01:39 PM

SirGive gravatar image

SirGive
1.2k 25 32 50

that's exactly what I needed to know too - thanks daniel

Dec 10 '10 at 02:54 PM mmuller

Thank you!! Literally have been searching for 2 hours for a solution.

Feb 10 at 07:33 AM BHS
(comments are locked)
10|3000 characters needed characters left

thanks for your help

more ▼

answered Oct 08 '10 at 06:16 PM

stringa gravatar image

stringa
257 37 39 42

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

x241
x137

asked: Oct 07 '10 at 10:30 PM

Seen: 1905 times

Last Updated: Feb 10 at 07:33 AM