Scripting API

GUIStyle

class in UnityEngine · UnityEngine.IMGUIModule

39 of 42 of Unity's membersUnity's documentation
In Tassix

How a control looks and is laid out: per-state backgrounds and text colors, font, alignment, padding and margins. Backgrounds are drawn stretched (their border isn't sliced).

Constructors 1

Properties 29

GUIStyleState active { get; set; }
TextAnchor alignment { get; set; }
RectOffset border { get; set; }
TextClipping clipping { get; set; }
Vector2 contentOffset { get; set; }
float fixedHeight { get; set; }
float fixedWidth { get; set; }
GUIStyleState focused { get; set; }
Font? font { get; set; }
int fontSize { get; set; }
FontStyle fontStyle { get; set; }
GUIStyleState hover { get; set; }
ImagePosition imagePosition { get; set; }
bool isHeightDependantOnWidth { get; }
float lineHeight { get; }
RectOffset margin { get; set; }
string name { get; set; }
static GUIStyle none { get; }
GUIStyleState normal { get; set; }
GUIStyleState onActive { get; set; }
GUIStyleState onFocused { get; set; }
GUIStyleState onHover { get; set; }
GUIStyleState onNormal { get; set; }
RectOffset overflow { get; set; }
RectOffset padding { get; set; }
bool richText { get; set; }
bool stretchHeight { get; set; }
bool stretchWidth { get; set; }
bool wordWrap { get; set; }

Methods 8

float CalcHeight(GUIContent content, float width)
void CalcMinMaxWidth(GUIContent content, out float minWidth, out float maxWidth)
Vector2 CalcScreenSize(Vector2 contentSize)
Vector2 CalcSize(GUIContent content)

The size content needs: its text on one line (or its image), plus padding.

void Draw(Rect position, bool isHover, bool isActive, bool on, bool hasKeyboardFocus)
void Draw(Rect position, GUIContent content, bool isHover, bool isActive, bool on, bool hasKeyboardFocus)
void Draw(Rect position, GUIContent content, int controlID)
void Draw(Rect position, GUIContent content, int controlID, bool on)
void Draw(Rect position, GUIContent content, int controlID, bool on, bool hover)
void DrawCursor(Rect position, GUIContent content, int controlID, int character)
void DrawWithTextSelection(Rect position, GUIContent content, int controlID, int firstSelectedCharacter, int lastSelectedCharacter)
string ToString()

Operators 1

static implicit operator GUIStyle(string str)

Not in Tassix yet 3

Finalize GetCursorPixelPosition GetCursorStringIndex