Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

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

HighlightSearchMode

enumeration

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

Description

Used to specify how to find a given element in the editor to highlight.

Let's consider various approaches to highlighting the Scale control in the Transform component.

Using the HighlightSearchMode.PrefixLabel mode you can specify the label text "Scale" as the identifier to highlight the entire Scale control with both label and all three number fields included. This mode can't be used if you want to only highlight the X component of the Scale control. Since the label text of the X component is simply "X", you would get the X component of the Position control instead if you attempted that. The HighlightSearchMode.PrefixLabel mode works for any control that uses EditorGUI.PrefixLabel or EditorGUI.HandlePrefixLabel.

If you use the HighlightSearchMode.Content mode to seach for the text "Scale", only the label itself will be highlighted. This mode can highlight what corresponds to a single GUIStyle.Draw call and hence cannot highlight composite controls. It is particularly useful for highlighting buttons.

The HighlightSearchMode.Identifier mode searches for rects explicitly marked to be highlightable using the Highlighter.HighlightIdentifier function. This is for example done for all controls that uses the SerializedProperty system, using the SerializedProperty.propertyPath as the identifier. This means you could use this mode to highlight the X component of the Scale control by searching for "m_LocalScale.x".

The HighlightSearchMode.Auto mode searches using all the above modes and can be used in most cases. Searching for "Scale" using this mode will highlight the entire Scale control rather than just the label, since the PrefixLabel handling is hit before the GUIStyle.Draw call of the label.

See Also: Highlighter.

Properties

NoneHighlights nothing.
AutoHighlights the first element found using any of the search modes.
IdentifierHighlights an element with a given identifier text.
PrefixLabelHighlights an entire editor control using its label text as identifier.
ContentHighlights an element containing text using the text as identifier.
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答