【unity】在EditorWindow添加自定义的Toolbar按钮
好久没写了,最近做工具,写了个EditorWindow,为了让使用者方便查看这个工具的文档,想着在导航栏加个问号按钮,点一下打开说明文档就完事~

查了下unity手册,发现Unity提供了一个 ShowButton 方法,用于在自定义Editor窗口的工具栏中添加自定义内容,下面是实现的例子:
private GUIStyle helpBtn; private void ShowButton(Rect position) { if (helpBtn == null) { helpBtn = new GUIStyle(GUI.skin.button) { padding = new RectOffset() }; } if (GUI.Button(position, UnityEditor.EditorGUIUtility.IconContent("_Help"), helpBtn)) { Application.OpenURL("百度一下,你就知道 (baidu.com)");//随便搞的网址 } }
需要直接cv吧~

浙公网安备 33010602011771号