用于自定义编辑器工具的图标和工具提示。如果此函数未实现,工具栏将显示用于目标类型的 Inspector 图标。如果未定义目标类型,工具栏将显示 Tool Mode 图标。
This property is accessed frequently, so load the icon's GUIContent in MonoBehaviour.OnEnable.
using UnityEditor.EditorTools; using UnityEngine; public class ToolbarIconSample : MonoBehaviour {} [EditorTool("Toolbar Icon Sample Tool", typeof(ToolbarIconSample))] class ToolbarIconSampleTool : EditorTool { GUIContent m_Icon; public override GUIContent toolbarIcon => m_Icon; private void OnEnable() { m_Icon = new GUIContent("Text Icon", "Toolbar Icon Sample Tool tooltip."); } private void OnDisable() { m_Icon = null; } }