Legacy Documentation: Version 2018.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

EditorGUI.HandlePrefixLabel

Suggest a change

Success!

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.

Close

Submission failed

For 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.

Close

Cancel

public static method HandlePrefixLabel(totalPosition: Rect, labelPosition: Rect, label: GUIContent, id: int = 0, style: GUIStyle = EditorStyles.label): void;
public static void HandlePrefixLabel(Rect totalPosition, Rect labelPosition, GUIContent label, int id = 0, GUIStyle style = EditorStyles.label);

Parameters

totalPositionRectangle on the screen to use in total for both the label and the control.
labelPositionRectangle on the screen to use for the label.
labelLabel to show for the control.
idThe unique ID of the control. If none specified, the ID of the following control is used.
styleOptional GUIStyle to use for the label.

Description

Make a label for some control.

HandlePrefixLabel is like PrefixLabel but allows custom control over the label position by supplying its Rect explicitly. PrefixLabel or HandlePrefixLabel should be used when creating a control with a connected label. It ensures that when the label is clicked, the control will get keyboard focus. For this reason it is important that the same ID is supplied to PrefixLabel or HandlePrefixLabel as to the control itself. It is also possible to not supply a Control ID, in which case the one from the immediately following control is automatically used.

Did you find this page useful? Please give it a rating: