class in UnityEngine
/
Implemented in:UnityEngine.IMGUIModule
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
CloseStyling information for GUI elements.
Most GUI functions accept an optional GUIStyle parameter to override the default style. This allows coloring, fonts and other details to be changed and switched for different states (eg, when the mouse is hovering over the control). Where a consistent look-and-feel is required over a whole GUI design, the GUISkin class is a useful way to collect a set of GUIStyle settings and apply them all at once.
none | Shortcut for an empty GUIStyle. |
active | Rendering settings for when the control is pressed down. |
alignment | Text alignment. |
border | The borders of all background images. |
clipping | What to do when the contents to be rendered is too large to fit within the area given. |
contentOffset | Pixel offset to apply to the content of this GUIstyle. |
fixedHeight | If non-0, any GUI elements rendered with this style will have the height specified here. |
fixedWidth | If non-0, any GUI elements rendered with this style will have the width specified here. |
focused | Rendering settings for when the element has keyboard focus. |
font | The font to use for rendering. If null, the default font for the current GUISkin is used instead. |
fontSize | The font size to use (for dynamic fonts). |
fontStyle | The font style to use (for dynamic fonts). |
hover | Rendering settings for when the mouse is hovering over the control. |
imagePosition | How image and text of the GUIContent is combined. |
lineHeight | The height of one line of text with this style, measured in pixels. (Read Only) |
margin | The margins between elements rendered in this style and any other GUI elements. |
name | The name of this GUIStyle. Used for getting them based on name. |
normal | Rendering settings for when the component is displayed normally. |
onActive | Rendering settings for when the element is turned on and pressed down. |
onFocused | Rendering settings for when the element has keyboard and is turned on. |
onHover | Rendering settings for when the control is turned on and the mouse is hovering it. |
onNormal | Rendering settings for when the control is turned on. |
overflow | Extra space to be added to the background image. |
padding | Space from the edge of GUIStyle to the start of the contents. |
richText | Enable HTML-style tags for Text Formatting Markup. |
stretchHeight | Can GUI elements of this style be stretched vertically for better layout? |
stretchWidth | Can GUI elements of this style be stretched horizontally for better layouting? |
wordWrap | Should the text be wordwrapped? |
GUIStyle | Constructor for empty GUIStyle. |
CalcHeight | How tall this element will be when rendered with content and a specific width. |
CalcMinMaxWidth | Calculate the minimum and maximum widths for this style rendered with content. |
CalcScreenSize | Calculate the size of an element formatted with this style, and a given space to content. |
CalcSize | Calculate the size of some content if it is rendered with this style. |
Draw | Draw this GUIStyle on to the screen, internal version. |
DrawCursor | Draw this GUIStyle with selected content. |
DrawWithTextSelection | Draw this GUIStyle with selected content. |
GetCursorPixelPosition | Get the pixel position of a given string index. |
GetCursorStringIndex | Get the cursor position (indexing into contents.text) when the user clicked at cursorPixelPosition. |
GUIStyle | Get a named GUI style from the current skin. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.