Trying to get ImageSharp working in the latest Unity3D #1822
Replies: 8 comments 9 replies
-
Helpers and classes missingThe issue with the Guard class will be because we have some shared infrastructure/code referenced from via Git Submodule that you will also need. Specifically you should follow the Manual Build section of the readme for instructions on pulling down the full set of source required to compile. Referencing the libraryI believe people will be referencing our published nuget package rather than the source code directly so the compilation issues with missing code wouldn't have been an issue. Please note I'm not a unity dev, I have never used it and I believe no one on the core team is a user either. Realtime usage/PerfThis is a big cavate on using it from unity.
So please keep in mind Please take all that that with a pinch of salt because, as stated earlier, I am no Unity dev and others more familiar with the environment might have different advice and are probably right 😀 |
Beta Was this translation helpful? Give feedback.
-
Thanks. It sounds complicated. I shudder everytime I see anything to do with the 'terminal' being a necessity. Whatever happened to ease of use and just having a zip with a full working version that someone can just load and use right away? Or even better, prebuilt binaries or something. I am somewhat familiar with C# but I really have no idea how to proceed with this on the basis of what's written in your post or on the pages you linked to. |
Beta Was this translation helpful? Give feedback.
-
I see a bunch of 'packages'. Seems the expectation is that someone knows what to do with them and to go into a terminal and run some commands to 'install' them somewhere. I'm not really trying to do that though. I need to get the binaries (dll's etc) into unity. |
Beta Was this translation helpful? Give feedback.
-
I also see a dll. Doesn't work on a mac. |
Beta Was this translation helpful? Give feedback.
-
Does anyone have a full set of current binaries like for windows and for mac intel + apple silicon? |
Beta Was this translation helpful? Give feedback.
-
Hmm. Well with the unity nugget package importer. .... it imports imagesharp .. but... then this error: "ArgumentException: The Assembly System.Runtime.CompilerServices.Unsafe is referenced by SixLabors.ImageSharp ('Assets/Packages/SixLabors.ImageSharp.1.0.4/lib/netstandard2.0/SixLabors.ImageSharp.dll'). But the dll is not allowed to be included or could not be found." By dll maybe it is referring to a binary that doesn't exist for my platform ? I dunno. |
Beta Was this translation helpful? Give feedback.
-
It at least didn't have any other errors besides this one as yet. |
Beta Was this translation helpful? Give feedback.
-
I managed to get it working in unity. Using the unity nuget importer I imported the ImageSharp package from nuget. Then also (eventually) was able to add the missing Unsafe package. Then I was able to reference it from script, loaded an image and saved it in another format. :-) My question now is .... this works on intel Mac x64 via a prebuilt binary/dll. Presumable would work on windows 64-bit too. But. ... what I'd like to happen is to get the source code for the library compiling within Unity/IL2CPP, so that Unity can deal with building for Apple Silicon and other platforms. Do you think that's feasible or likely work, or how I might go about it? |
Beta Was this translation helpful? Give feedback.
-
Hey folks. So ImageSharp could potentially fill a lot of useful duties for my app, thank you for developing it. I'm working in Unity, latest version. So I presume what I'm supposed to do is just dump the source code folder into a unity project, and then unity compiles it right?
When I do this, I get a LOT of compilation errors. I tried both mono and IL2CPP. I get many errors like:
The name "Unsafe" does not exist in the current context
The name "ThrowHelper" does not exist in the current context
"Guard" does not contain a definition for "NotNull"
"Guard" does not contain a definition for "MustBeGreaterThanOrEqualTo"
"Guard" does not contain a definition for "MustBeLessThan"
I switched on 'allow unsafe code' in Unity, didn't seem to make any difference.
There's apparently more than 1000 of these errors.
So.... something is not quite right. Am I missing something? It sounded from a couple other threads that some people were successfully using this in unity? How do I go about getting the library to work?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions