- Home /
Error: Unable to load the icon: 'CustomEditorWindow'. (Custom Scene View)
Creating and opening a custom editor window which derives from SceneView
causes the following error:
Unable to load the icon: 'CustomEditorWindow'.
Note that either full project path should be used (with extension) or just the icon name if the icon is located in the following location: 'Assets/Editor Default Resources/Icons/' (without extension, since png is assumed)
UnityEditor.EditorWindow:CreateWindow(String, Type[])
CustomEditorWindow:Init() (at Assets/Scripts/Editor/TestEditorWindow.cs:8)
Why is this happening? What am I doing wrong? Or is this a bug?
The Code is as simple as it gets:
using UnityEditor;
public class CustomEditorWindow : SceneView
{
[MenuItem("Window/Custom Editor Window")]
public static void Init ()
{
CreateWindow<CustomEditorWindow>("Custom Editor Window");
}
}
Any suggestions?
Answer by viesc123 · May 29, 2020 at 08:25 PM
If you create an image file and leave out the window title, when creating it in the code, you can see where the image is supposed to go :) "Scene" seems to be the default name, when none is further specified.
Ah, now i get it. Great, thanks.
Just out of curiousity, how would i go about the former option? specifying a path that isnt 'Assets/Editor Default Resources/Icons'?
Dug into the base code and the setting of the icon comes from an [EditorWindowTitle(title = "Scene", useTypeNameAsIconName = true)]
attribute used on the SceneView
class. Unfortunately, the attribute is marked internal
and my C# knowledge is too limited to know how to work around this...
Probably not worth working arund the limitation. The default folder is good enough since everything is now working as intended without errors. Thanks again mate.