用于指定如何查找要在编辑器中突出显示的给定元素。
让我们考虑一些在 Transform 组件中突出显示 Scale 控件的各种方法。
使用 HighlightSearchMode.PrefixLabel 模式,您可以将标签文本“Scale”指定为标识符,以突出显示整个 Scale 控件,并且包含标签和所有具有三个数字的字段。如果只要突出显示 Scale 控件的 X 组件,则无法使用此模式。由于 X 组件的标签文本只是“X”,因此如果您尝试使用此模式,就会获得 Position 空间的 X 组件。HighlightSearchMode.PrefixLabel 模式适合使用 EditorGUI.PrefixLabel 或 EditorGUI.HandlePrefixLabel 的任何控件。
If you use the HighlightSearchMode.Content mode to search 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.
HighlightSearchMode.Identifier 模式使用 Highlighter.HighlightIdentifier 函数搜索显式标记为可突出显示的矩形。例如,对于使用 SerializedProperty 系统的所有控件而言,可以通过将 SerializedProperty.propertyPath 用作标识符完成此操作。这意味着,您可以通过使用此模式搜索“m_LocalScale.x”来突出显示 Scale 控件的 X 组件。
HighlightSearchMode.Auto 模式使用上述所有模式进行搜索,而且适用于大多数情况。使用此模式搜索“Scale”将突出显示整个 Scale 控件,而不只是标签,这是因为先命中 PrefixLabel 处理,然后再调用标签的 GUIStyle.Draw。
另请参阅:Highlighter。
None | 不突出显示任何内容。 |
Auto | 突出显示使用上述任一搜索模式找到的第一个元素。 |
Identifier | 突出显示具有给定标识符文本的元素。 |
PrefixLabel | 突出显示将自身标签文本作为标识符的整个编辑器控件。 |
Content | 突出显示包含文本且将文本用作标识符的元素。 |
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.