Set icon of EditorWindow

I need to set the icon of an EditorWindow (meaning the icon that is next to the title of an editor panel), but can’t find a way to do it. Anyone knows how it can be done?


Found a way, using Reflection and accessing a hidden getter in the EditorWindow class.

I added it as a simple method in my HOUnityLibs open-source library, inside the HOEditorUtils.HOPanelUtils static class. You can simply call:

HOPanelUtils.SetWindowTitle(EditorWindow editorWindow, Texture icon, string title);

If you’re curious about the code to do it, it’s here.

EDIT: @numberkruncher has also an alternate solution, on Unity Forums

Pretty sure this isn’t exposed, sorry.

Others want this ability too → from the forum