Open YangSama opened 7 months ago
(As mentioned over email, this is on an Apple Silicon computer)
That is actually a platform I hadn't tested on, I only have access to an Intel Mac. It's a failure of my part to not have made that clear in the store description, I'll correct that.
Upon some exploration, looks like the SVG parsing library Keen uses, SVG.NET, depends on GDI+, which is not included in non-Windows distributions of .NET. My primary development platform is Linux, so I had considered that and mitigated it with https://github.com/CoreCompat/libgdiplus-packaging/, however, that doesn't appear to offer binaries for Apple Silicon, only Intel (or other operating systems).
Can you try a couple things?
I don't have access to an Apple Silicon computer at the moment so I can attempt these myself, but I'll try to track one down.
A more sane alternative in this case would be to replace SVG.NET wholesale, since I don't actually even use any of its "drawing" features that have this dependency, just the document processing itself. But that is not a small project due to the scope of the format. I cannot give you a specific time frame as I am currently employed full-time, so my availability is limited, but it would probably be over a month.
In the meanwhile, I'll update the Asset Store listing to make this glaring limitation clear. If you deem appropriate, you may request a refund, and I will notify you when this is resolved here in this issue (make sure to keep the subscription to this issue's notifications), or at your option in the e-mail address you provided.
(As mentioned over email, this is on an Apple Silicon computer)
That is actually a platform I hadn't tested on, I only have access to an Intel Mac. It's a failure of my part to not have made that clear in the store description, I'll correct that.
Upon some exploration, looks like the SVG parsing library Keen uses, SVG.NET, depends on GDI+, which is not included in non-Windows distributions of .NET. My primary development platform is Linux, so I had considered that and mitigated it with https://github.com/CoreCompat/libgdiplus-packaging/, however, that doesn't appear to offer binaries for Apple Silicon, only Intel (or other operating systems).
Can you try a couple things?
An easy one, let's see if Apple's Rosetta works in this case:
- In the Project view, go to Packages > Keen Vectors > Editor > Plugins, select "runtime.osx.10.10-x64.CoreCompat.System.Drawing.dll";
- In the inspector, set the platform settings' "CPU" field to "Any CPU";
- Exit and reopen the Unity editor;
- Right click your SVG file in the Project tab and select "Reimport";
- Let me know if it works or there are any different errors.
- If you are willing and able, you could try building and installing https://github.com/mono/libgdiplus from source on your system, see if it works and kindly report back.
I don't have access to an Apple Silicon computer at the moment so I can attempt these myself, but I'll try to track one down.
A more sane alternative in this case would be to replace SVG.NET wholesale, since I don't actually even use any of its "drawing" features that have this dependency, just the document processing itself. But that is not a small project due to the scope of the format. I cannot give you a specific time frame as I am currently employed full-time, so my availability is limited, but it would probably be over a month.
In the meanwhile, I'll update the Asset Store listing to make this glaring limitation clear. If you deem appropriate, you may request a refund, and I will notify you when this is resolved here in this issue (make sure to keep the subscription to this issue's notifications), or at your option in the e-mail address you provided.
I am currently utilizing Keen on my Windows computer, where it operates smoothly. Upon testing the first solution you mentioned, it seems to elicit the same error as before.
Asset import failed, "Assets/1712060476Dragon19a 1.svg" > DllNotFoundException: libgdiplus.dylib assembly:<unknown assembly> type:<unknown type> member:(null)
System.Drawing.GDIPlus..cctor () (at <2356acc98ad24b8d92e112859b7be065>:0)
Rethrow as TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception.
System.Drawing.Drawing2D.Matrix..ctor (System.Single m11, System.Single m12, System.Single m21, System.Single m22, System.Single dx, System.Single dy) (at <2356acc98ad24b8d92e112859b7be065>:0)
(wrapper remoting-invoke-with-check) System.Drawing.Drawing2D.Matrix..ctor(single,single,single,single,single,single)
Svg.SvgDocument.EnsureSystemIsGdiPlusCapable () (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Rethrow as SvgGdiPlusCannotBeLoadedException: Cannot initialize gdi+ libraries. This is likely to be caused by running on a non-Windows OS without proper gdi+ replacement. Please refer to the documentation for more details.
Svg.SvgDocument.EnsureSystemIsGdiPlusCapable () (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Svg.SvgDocument.Create[T] (System.Xml.XmlReader reader) (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Svg.SvgDocument.Open[T] (System.IO.Stream stream, System.Collections.Generic.Dictionary`2[TKey,TValue] entities) (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Svg.SvgDocument.Open[T] (System.String path, System.Collections.Generic.Dictionary`2[TKey,TValue] entities) (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Svg.SvgDocument.Open (System.String path) (at <aa04951248aa4521ab1dfb5b98100c49>:0)
Kroltan.Keen.Editor.SvgImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Packages/me.kroltan.keen-vectors/Editor/SvgImporter.cs:40)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /Users/bokken/build/output/unity/unity/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:25)
(Filename: ./Modules/AssetPipelineEditor/Public/ScriptedImporter.cpp Line: 220)
I have modified the settings as follows:
I hope that in the future, Keen can extend its support to Apple Silicon.🙏
Thank you very much for checking! I'll keep you posted when I have something to share.
Unity 2022.3.21f1, import svg fail.
Asset import failed, "Assets/undraw_undraw_sign_upln1s-1-_ofs1.svg" > DllNotFoundException: libgdiplus.dylib assembly: type: member:(null)
System.Drawing.GDIPlus..cctor () (at <2356acc98ad24b8d92e112859b7be065>:0)
Rethrow as TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception.
System.Drawing.Drawing2D.Matrix..ctor (System.Single m11, System.Single m12, System.Single m21, System.Single m22, System.Single dx, System.Single dy) (at <2356acc98ad24b8d92e112859b7be065>:0)
(wrapper remoting-invoke-with-check) System.Drawing.Drawing2D.Matrix..ctor(single,single,single,single,single,single)
Svg.SvgDocument.EnsureSystemIsGdiPlusCapable () (at :0)
Rethrow as SvgGdiPlusCannotBeLoadedException: Cannot initialize gdi+ libraries. This is likely to be caused by running on a non-Windows OS without proper gdi+ replacement. Please refer to the documentation for more details.
Svg.SvgDocument.EnsureSystemIsGdiPlusCapable () (at :0)
Svg.SvgDocument.Create[T] (System.Xml.XmlReader reader) (at :0)
Svg.SvgDocument.Open[T] (System.IO.Stream stream, System.Collections.Generic.Dictionary:0)
Svg.SvgDocument.Open (System.String path) (at :0)
Kroltan.Keen.Editor.SvgImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Packages/me.kroltan.keen-vectors/Editor/SvgImporter.cs:40)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at /Users/bokken/build/output/unity/unity/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:25)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:203)
2[TKey,TValue] entities) (at <aa04951248aa4521ab1dfb5b98100c49>:0) Svg.SvgDocument.Open[T] (System.String path, System.Collections.Generic.Dictionary
2[TKey,TValue] entities) (at(Filename: ./Modules/AssetPipelineEditor/Public/ScriptedImporter.cpp Line: 220)