Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrefixLabel

Makes a label in front of some control.
Read time 4 minutesLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor.CoreModule

PrefixLabel(Rect, GUIContent)

Makes a label in front of some control.
public static Rect PrefixLabel(Rect totalPosition, GUIContent label)

Parameters

totalPosition

Rectangle on the screen to use in total for both the label and the control.

Label to show in front of the control.

Returns

Type

Description

RectRectangle on the screen to use just for the control itself.

Remarks

EditorGUIPrefixLabel (PrefixLabel)
Prefix Label in an Editor Window.
Note that most editor controls already have built-in optional labels that can be specified as one of the parameters. PrefixLabel can be used when there is no such built-in label available, or when you're creating your own editor control from scratch.
PrefixLabel takes a rect that's the rect for the entire control, including the label, and returns a rect that's for just the control itself, without the label.
PrefixLabel also ensures that when the label is clicked, the linked control will get keyboard focus (if the control supports keyboard focus). The ID of the linked control can optionally be specified, or if no ID is given, the label is automatically linked to the following control coming after it.

PrefixLabel(Rect, GUIContent, GUIStyle)

Makes a label in front of some control.
public static Rect PrefixLabel(Rect totalPosition, GUIContent label, GUIStyle style)

Parameters

totalPosition

Rectangle on the screen to use in total for both the label and the control.

Label to show in front of the control.

Style to use for the label.

Returns

Type

Description

RectRectangle on the screen to use just for the control itself.

Remarks

EditorGUIPrefixLabel (PrefixLabel)
Prefix Label in an Editor Window.
Note that most editor controls already have built-in optional labels that can be specified as one of the parameters. PrefixLabel can be used when there is no such built-in label available, or when you're creating your own editor control from scratch.
PrefixLabel takes a rect that's the rect for the entire control, including the label, and returns a rect that's for just the control itself, without the label.
PrefixLabel also ensures that when the label is clicked, the linked control will get keyboard focus (if the control supports keyboard focus). The ID of the linked control can optionally be specified, or if no ID is given, the label is automatically linked to the following control coming after it.

PrefixLabel(Rect, int, GUIContent)

Makes a label in front of some control.
public static Rect PrefixLabel(Rect totalPosition, int id, GUIContent label)

Parameters

totalPosition

Rectangle on the screen to use in total for both the label and the control.

id

The unique ID of the control. If none specified, the ID of the following control is used.

Label to show in front of the control.

Returns

Type

Description

RectRectangle on the screen to use just for the control itself.

Remarks

EditorGUIPrefixLabel (PrefixLabel)
Prefix Label in an Editor Window.
Note that most editor controls already have built-in optional labels that can be specified as one of the parameters. PrefixLabel can be used when there is no such built-in label available, or when you're creating your own editor control from scratch.
PrefixLabel takes a rect that's the rect for the entire control, including the label, and returns a rect that's for just the control itself, without the label.
PrefixLabel also ensures that when the label is clicked, the linked control will get keyboard focus (if the control supports keyboard focus). The ID of the linked control can optionally be specified, or if no ID is given, the label is automatically linked to the following control coming after it.

PrefixLabel(Rect, int, GUIContent, GUIStyle)

Makes a label in front of some control.
public static Rect PrefixLabel(Rect totalPosition, int id, GUIContent label, GUIStyle style)

Parameters

totalPosition

Rectangle on the screen to use in total for both the label and the control.

id

The unique ID of the control. If none specified, the ID of the following control is used.

Label to show in front of the control.

Style to use for the label.

Returns

Type

Description

RectRectangle on the screen to use just for the control itself.

Remarks

EditorGUIPrefixLabel (PrefixLabel)
Prefix Label in an Editor Window.
Note that most editor controls already have built-in optional labels that can be specified as one of the parameters. PrefixLabel can be used when there is no such built-in label available, or when you're creating your own editor control from scratch.
PrefixLabel takes a rect that's the rect for the entire control, including the label, and returns a rect that's for just the control itself, without the label.
PrefixLabel also ensures that when the label is clicked, the linked control will get keyboard focus (if the control supports keyboard focus). The ID of the linked control can optionally be specified, or if no ID is given, the label is automatically linked to the following control coming after it.