DllNotFoundException: libcairo-2.dll

Hi, I had a project working in Unity 3 beta (last tested in beta 7) under Windows 7. I've since changed machine from Win7 32-bit to 64-bit, and also upgraded to Unity 3 RC 2 at the same time. Now my project no longer runs and I'm not sure what's caused it.

The project uses Cairo and Pango -- so I copy Mono.Cairo.dll, pango-sharp.dll and glib-sharp.dll from various places in the Unity exe folder, into my Unity project's Plugins folder. When I call the Cairo.ImageSurface constructor, I get the error DllNotFoundException: libcairo-2.dll.

I've tried copying libcairo-2.dll into my Windows\System32 folder, into the same folder as the Unity exe, into my project's Plugins, Assets and Libraries folders -- all with no effect. How do I get it to work?

I encountered this problem too when I try to load DLL plugin in windows 7 64bit. It's solved by running Unity.exe in "XP Service Pack 3" compatibility mode. You may give it a try: right click "Unity.exe" in your Unity installation folder and enable "compatibility mode".

Same problem in OSX Mountain Lion. Obviously no Windows workaround will work here…

  1. I think you have to download full gtk-bundle, which contains cairo and so on (http://www.gtk.org/download/win32.php).
    For Unity mono use !!! 32-bit only !!!
  2. Unzip it to some location, for example /opt/gtk
  3. Add gtk BIN (!) folder to system path (in my case: /opt/gtk/bin)
  4. Try to restart Unity and run scene again