guistyle.CalcSize returning unexpected values...

as the title says the vector2 im getting back is way off. it should be something around (100, 30)

Vector2 size = skin.label.CalcSize(new GUIContent("Save Position"));

(14.0, 214.0) UnityEngine.Debug:Log(Object) is what im getting in the console...

any ideas whats going wrong?

more ▼

asked Jan 31 '13 at 10:39 AM

gheeler gravatar image

266 6 16 23

skin is my own GUISkin object and the label style uses standard arial at the standard size and the top and bottom padding are both 3

Jan 31 '13 at 10:48 AM gheeler
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I am getting the same problem. The CalcSize is giving me (14,0 , 24.0) as a Vector2 return when my block of text easily fills a 730.0 wide and 400.0 tall box on the screen.

Edit: I could not find the solution for this

I have a GuiContent element with text.

CalcSize now returns a Vector2 (2400.0, 24.0)

CalcHeight, width 700, called on that same GuiContent should return 96 (4x 24)

CalcHeight however always returns 24.0 regardless of the width. Not sure why.

I ended up just using CalcSize and calculating my own height from that.

more ▼

answered Oct 19 '13 at 12:30 PM

hubecube_ gravatar image

1 1

(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



Answers and Comments



asked: Jan 31 '13 at 10:39 AM

Seen: 626 times

Last Updated: Oct 19 '13 at 01:36 PM