Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by Dark-Table · Aug 22, 2011 at 01:19 AM · macstandalonedllnotfoundexception

How do you load System.Drawing.dll and gdiplus.dll on Unity Mac?

I've got a project that is using an external assembly that requires System.Drawing.dll and gdiplus.dll.

Gdiplus.dll is a native dll for windows. There's a version of it for mono platforms called libgdiplus. I've built this for the Mac, but can't figure out how to convince Unity (Editor or Mac Standalone) to load this dylib (libgdiplus.dylib). The dylib is currently living in /opt/local/lib and that folder is on my system path.

When I attempt to run the project I get the following error:

 DllNotFoundException: gdiplus.dll
 System.Drawing.GDIPlus..cctor ()
 Rethrow as TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus
 System.Drawing.Image.Dispose (Boolean disposing)
 System.Drawing.Image.Finalize ()

The Mono documentation seems to indicate that Mono will automatically attempt to append lib to the name of the dll and swap the dll for dylib if it can't find the requested dll. I'm not sure if the version of Mono that Unity uses does this as well?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DanSuper · Jan 09, 2013 at 07:32 PM 1
Share

I'd love to know if you ever solved this because I'm also having the same issue trying to integrate the AForge imaging library with Unity.

avatar image Dark-Table · Jan 11, 2013 at 03:54 AM 0
Share

No, I never did manage to solve this. Sorry. I believe it was AForge that I was working with too.

avatar image PraetorBlue · Dec 22, 2013 at 06:14 AM 0
Share

I'm also having this problem... here in 2013 :(

avatar image VReel · Mar 26, 2017 at 09:17 AM 0
Share

Now in 2017, do we have a solution for this?

I'm simply trying to make use of the System.Drawing.Bitmap class, on Android, but the construction is failing due to "gdiplus.dll" not being found.

Thanks in advance...

8 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by DVFrance · Mar 01, 2018 at 06:33 PM

I finally found a way to correct that error on Mac OSX High Sierra.

You have to add some links to your Unity configuration.

  1. First check your mono.framework version:

    /Library/Frameworks/Mono.framework/Versions/5.4.1/lib/libgdiplus.dylib

  2. Then in your Unity config, you can find here:

    " /Applications/Unity/Unity.app/Contents/Mono/etc/mono/config "

Add the following lines (change the version by yours):

 <dllmap dll="gdiplus" target="/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/libgdiplus.dylib" />
      <dllmap dll="gdiplus.dll" target="/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/libgdiplus.dylib" />

Once you made this, save and restart Unity and let the magic play !

Hope it helps !

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image snmt_singh · Mar 06, 2018 at 12:52 PM 0
Share

Hey, I did exactly what you told, but I am getting same error but now with the path I specified. /Applications/Unity/$$anonymous$$onoDevelop.app/Contents/Frameworks/$$anonymous$$ono.framework/Versions/Current/lib/libgdiplus.dylib

I checked , the gdiPlus is there only.

avatar image DVFrance snmt_singh · Mar 06, 2018 at 01:04 PM 1
Share

Hi, Take a look on your path, version number is missing, so I think the path does not exist :

/Applications/Unity/$$anonymous$$onoDevelop.app/Contents/Frameworks/$$anonymous$$ono.framework/Versions/versionNumber/lib/libgdiplus.dylib

Let me know.

avatar image manelroure · Mar 08, 2018 at 10:18 AM 0
Share

I had the same problem and it is exactly what I needed. It works perfectly. Thanks for the solution.

avatar image
3

Answer by emisael-carrera · Jun 25, 2019 at 02:52 AM

Hi!

For newer versions of Unity (Unity Hub) the mono config file to edit must be:


/Applications/Unity/Hub/Editor/X.X.X/Unity.app/Contents/MonoBleedingEdge/etc/mono/config


Wrong:

/Applications/Unity/Hub/Editor/X.X.X/Unity.app/Contents/Mono/etc/mono/config


Note: X.X.X is the version of Unity.

Greets.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by martinj · Aug 13, 2014 at 03:19 PM

Did anyone manage to get System.Drawing to work on OS X / iOS / Android?

I canont get the propsed solution to work.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Brian Deans-Rowe · Aug 13, 2014 at 06:11 PM 0
Share

Unfortunately no. There is some hope down the road with SparseTextures, but $$anonymous$$avericks doesn't support the required gl call (ARB_sparse_texture) and as far as I've been able to tell, Yosemite won't either. $$anonymous$$aybe next year for $$anonymous$$ac. I don't know what gl versions are supported on Android; that's not a platform I've been supporting yet.

avatar image
1
Wiki

Answer by Brian Deans-Rowe · Jun 20, 2013 at 06:37 PM

I'll chime in as another person hoping to find a solution to this.

I've been looking at the config file where dll remapping happens

(/Applications/Unity/Unity.app/Contents/Frameworks/Mono/etc/mono/config)

and copied into it the remapping lines that are in the MonoDevelop version of the file

(/Applications/Unity/MonoDevelop.app/Contents/Frameworks/Mono.framework/Versions/2.10.2/etc/mono):

dllmap dll="gdiplus.dll" target="/Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/2.10.2/lib/libgdiplus.dylib" os="!windows"

dllmap dll="gdiplus" target="/Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/2.10.2/lib/libgdiplus.dylib" os="!windows"

(those lines need delimiting if you copy them into the config file. I can't get the delimited text to show up in the post. Just follow the convention you find in the file)

I added the os="!windows" bit to both the MonoDevelop and Unity config files as that seems to be the standard incantation.

Then I restarted Unity and MonoConfig and pressed Play and got a slightly altered error message that shows that the new mapping is being seen:

DllNotFoundException: /Applications/Unity/MonoDevelop.app/Contents/MacOS/../Frameworks/Mono.framework/Versions/2.10.2/lib/libgdiplus.dylib System.Drawing.GDIPlus..cctor () Rethrow as TypeInitializationException: An exception was thrown by the type initializer for System.Drawing.GDIPlus System.Drawing.Image.Dispose (Boolean disposing) System.Drawing.Image.Finalize ()

The dylib does live where the remapping points, so I can only imagine that the System.Drawing.GDIPlus constructor is for some reason not being found in the library?

A quick search of the dylib with 'nm -g | grep -i gdiplus' outputs just two symbols:

libgdiplus.0.dylib(single module): 0000d510 T _GdiplusShutdown 0000d650 T _GdiplusStartup

I'm no expert at reading the output, but I couldn't find anything that looked like the constructor to me in a quick visual scan of the full output of 'nm -g'.

I'm starting to feel like this may be all the yardage I can manage on this problem and I'm hoping someone out there can pick up the ball and manage a few more yards with it.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by RedLing · May 08, 2018 at 02:31 AM

I have the same problem on the android platform, do you have a good solution ?

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

17 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Networking: Available Servers 1 Answer

Error with Mac Build 2 Answers

Unity 2018.3.3 Post Processing effect not showing on Mac build but showing on Editor. 0 Answers

Mac standalone build Dock question 0 Answers

Getting this error when doing a mac build: 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges