- Home /
Question by
patrik-org · May 21, 2016 at 10:20 AM ·
guiuser interfacerecttransform
Calculate pixel size of stretched RectTransform in editor
So I need to know the actual pixel width and height of a stretched UI game object. During runtime I can check RectTransform.rect.width but is not set initially. I need to know the size of a stretched element in the editor, is there a way make Unity update this information in the RectTransform?
Comment
@exmakina
Hi, what are you trying to do?
Editor scripting or something else?
$$anonymous$$ight help if it was just clear what you are trying to achieve.
Editor scripting. I'm creating a generic list that is arranging elements (parsed from xml). To arrange the items (and have them show up correctly in the editor) I need to calculate the stretched size of the list. So I need to know the size of the stretched UI element in the editor.