The effect is shown in the picture↓↓↓
-
EditorWindow.titleContent is needed , but there are no more official examples
-
First prepare the picture in Png format, the maximum size: I personally suggest not to exceed 200*200, and it will be compressed into 20*20 in the end, so try to choose some obvious patterns.
-
The code is very simple, first draw a custom window, and then redefine the icon
using UnityEditor;
using UnityEngine;
public class LiamEditor : EditorWindow
{
[MenuItem("Wemake/LiamEditor")]
static void Init()
{
LiamEditor window = GetWindow<LiamEditor>();//绘制窗口
Texture icon = AssetDatabase.LoadAssetAtPath<Texture>("Assets/Resources/Icon/Menu.png");//图标路径
GUIContent titleContent = new GUIContent(" LiamEditor", icon);//标题 图标
window.titleContent = titleContent;
window.Show();
}
}
If it's useful, give it a triple!