Can I use p/invoke in libraries loaded as assets in Unity Free?

I am interested in using utilising third-party libraries in Unity Free.

I know Unity can use managed libraries as assets, but only the Pro version supports using native libraries (DllImport within scripts). This thread, however suggests that it is possible to import DLLs in the free version.

I would like to utilise native libraries (as a hobbyist I cannot afford the Pro version), but want to do it the supported way so I don't have to worry about Unity 'fixing' this hole if that is what it is.

Is there any supported way to use native libraries with Unity free (in other words, is the method described in that thread using DllImport safe and reliable, or is it a workaround that might be patched away)?

• You could consider using a managed C++ dll to communicate between the two if unity doesn't support native C++ in their free distribution.
– Evan
Mar 5 '13 at 23:29
• Late reply.. but why not try it yourself? You can build your .exe with Unity free and have it load your native code DLL fine. Unity Pro only seems to restrict plugins when they reside in the Asset/Plugins. This work around isn't ideal, but could do the trick. Jun 26 '13 at 16:30
• @Fabien, I definitely would to see if it worked - actually from what I have read I am pretty sure it would work - but theme of the question was meant to be more... is it going to work in 2 years time when Unity XYZ is released. :)
– sebf
Jun 30 '13 at 18:55

You can use DllImport in compiled managed DLLs which are referenced in your C# code.
• Surely Googling DLLImport provides more than enough examples? Aug 20 '16 at 4:30