Gentlymad-Studios / NewGraph

A general node graph solution centered on data management. This is based on the idea to visualize complex data structures as graph networks without having to modify already established data classes.
MIT License
246 stars 19 forks source link

Unable to load the icon: 'd_winbtn_win_close' on Mac #52

Open noio opened 7 months ago

noio commented 7 months ago

First off, I love this package and its philosophy, I've only just begun using it but having a generic visualization/editor for graph based data is just amazing. Unity should have this built in. Thanks so much for sharing this with your fellow game devs 🙏

This is just a tiny bug that I'm seeing, it's also not affecting the workflow in any way, I think:

When opening a graph, an error is thrown because Unity can't find the icon d_winbtn_win_close. Which makes sense, as I assume that's a windows only icon.

I normally wouldn't open an issue for mac specific issues, that just might not be a target platform for this package.

But I see you're beautifully handling some Mac specific stuff already! (e.g. showing the char for the Command key) 💕

Below is the full stack trace: (again, this occurs when opening a graph)

[Error] Unable to load the icon: 'd_winbtn_win_close'.
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)
EditorGUIUtility.IconContent()

NewGraph.EditableLabelElement..ctor() at ./Library/PackageCache/com.gentlymad.newgraph@d41b4e6e29/Editor/Views/Elements/EditableLabelElement.cs:32

NewGraph.ScriptableInspectorControllerGeneric`1<NewGraph.ScriptableGraphModel>.CreateRenameGraphUI() at ./Library/PackageCache/com.gentlymad.newgraph@d41b4e6e29/Editor/Controllers/ScriptableInspectorControllerGeneric.cs:113

InspectorControllerBase.Draw() at ./Library/PackageCache/com.gentlymad.newgraph@d41b4e6e29/Editor/Controllers/InspectorControllerBase.cs:218

GraphController.Draw() at ./Library/PackageCache/com.gentlymad.newgraph@d41b4e6e29/Editor/Controllers/GraphController.cs:534

GraphWindow.OnGUI() at ./Library/PackageCache/com.gentlymad.newgraph@d41b4e6e29/Editor/Views/GraphWindow.cs:123

GUIUtility.ProcessEvent() at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:206
noio commented 7 months ago

Update: I think a fix could be as simple as the following line in EditableLabelElement.cs :

Screenshot 2024-05-02 at 10 23 10

noio commented 7 months ago

Hm okay another update:

I am actually not sure which "OS button icons" are still available in Unity 2023.

Maybe the issue is not Win vs Mac but more that Unity is no longer including any OS-specific icons in 2023?

This list contains winbtn_win and winbtn_mac variants, but when I examine the icons in my (2023) Unity, using Internal Icon Browser, then I'm actually not seeing any winbtn icons.

Perhaps if you're looking to just show a simple cross, it's safer to just use d_clear ?

Screenshot 2024-05-02 at 10 28 29

atellio commented 5 months ago

Also getting this issue in Unity Pro 2023.2.20f1 on Windows.

image

Consalv0 commented 3 months ago

Im using this to fix the problem in Unity 6

#if UNITY_6000_0_OR_NEWER
        private const string closeIcon = "CrossIcon";
#else
        private const string closeIcon = "d_winbtn_win_close";
#endif