问题
I'm looking for an alternative to using the System.Drawing in Unity3D, since apparently Unity doesn't support it. I'd like to simply draw some lines on a texture. But I want options such as line width and edge rounding, which are fairly complex. GraphicsMagick seemed perfect, plus it's free.
So here's the steps I've already taken:
1) I changed my playersettings to use api compatability level 2.0, not "subset".
2) I downloaded GraphicsMagick .Net 2.0 x64 wrapper, extracted the dll.
3) Right clicked the dll in Windows Explorer, selected properties, and unblocked the dll.
4) Put the dll into my assets/plugins folder.
5) Took the System.Drawing dll out of the \Program Files\Unity\Editor\Data\Mono\lib\mono\2.0 folder, and put it into my assets/plugins folder.
6) added reference to both those dlls in my project References (Visual Studio 2015).
7) added "using GraphicsMagick" to my c# script.
It compiles just fine in Visual Studio 2015, with no errors. But when I switch back to Unity, it says:
Assets/_GeoSphere/_ScriptsCS/DrawLineUV.cs(5,7): error CS0246:
The type or namespace name `GraphicsMagick' could not be found.
Are you missing a using directive or an assembly reference?
also, unity seems to remove the reference to GraphicsMagick from my project references.
So after heavy research into the issue, I am beginning to think the issue has something to do with the fact that the dll is unmanaged / native. I'm using Unity 5 free, but it is my understanding that it now supports native dlls.
I just want to draw a smooth, wide, and rounded-edged line! And I wouldn't mind the Bezier curves. If someone knows how to get GraphicsMagick to work in Unity3D, even if the process is rather involved, please elaborate. Thanks. :)
来源:https://stackoverflow.com/questions/34067289/using-graphicsmagick-in-unity3d