Unity free, plugins and native DLLs

Everyone knows that plugins are only supported in Unity Pro. It’s also a common knowledge here (on Forums and Answers) that if you have a native dll, you have to put it in Plugins folder and own the Pro license to be able to use it. Actually this knowledge is wrong, at least on Windows. The documentation states that plugins are native libraries, but it doesn’t state that every native library is a plugin. So, you can call functions from native libraries without the Pro license.

  1. Download the standard plugin example from here.
  2. Run it using free Unity and get the error “License error. Plugins are only supported in Unity Pro!”
  3. Move the dll from Project/Assets/Plugins to just Project/.
  4. Run it again and get no errors. It works fine.
  5. Make a standalone build, copy the dll to where the executable is, and it will work too.

thanks for the info. i have filed a bug report.

Are you sure the example gives a native code plugin? I was under the impression that C# assemblies worked in Unity Free.

as the given example contains cpp files it is native code. the inlcuded c# file only calls the plugin. i have no unity free installed (and no c++ environment) to test and verifiy this but the given explanation sounds reasonable and could be a bug which can be exploited.

First I tried it with my own native dll and it worked, then I checked the standard plugins example, it worked too. So, I have no doubts. I don’t think it’s a bug for several reasons.

  1. It’s been there for ages. Just rechecked with Unity 3.0 and it works.

  2. Platform invoke is a standard net/mono functionality and I expect it to work unless the opposite is stated explicitly. Just like accessing managed libraries you’ve mentioned.

  3. Mono is not a UT’s product. I believe it would be a kind of dirty trick to cut off a part of someone else’s free product and then sell this part back for money. Either you support the feature or you don’t, with no money conditions attached.

  4. Platform invoke is the only way to call WinAPI. For example, if you want to show a MessageBox you have to call a function from “user32.dll” which is definitely not a plugin for Unity. If any calls to native libraries other than libraries in Plugins folder were prohibited, you would have to create a native wrapper library around the native Windows library to be able to access the MessageBox function from your managed code. It sounds like a stupid waste of time and effort to me. Why not just call it directly?

I also tried to run a low-level rendering plugin on Unity Free - Unity - Manual: Low-level native plug-in interface

It doesn’t work, just as expected, because it’s not just an ordinary native dll, but the one that actually uses the API for plugins.

Any updates yet on your bug report?

No. you can follow it here.

Unity Indie in 2009 also supported native dlls.

http://forum.unity3d.com/threads/30817-UnityAR-ARToolkit-Interface?p=201913&viewfull=1#post201913
http://forum.unity3d.com/threads/56013-Can-I-use-DLLs-in-Unity-free?p=660419&viewfull=1#post660419

Yes.
Have a look on my signature. I’ve a TTS DLL that works with Unity indie since 2010.

The “System.Runtime.InteropServices” was disabled by UT in the past. :frowning:

Nice, would this work with KopiLua and KopiLuaInterface?

Thanks.

I don’t understand why Plugins for desktop platforms are not free. I mean there are just to many ways to get around it anyway.
You could even recompile Mono to force features on. Just seems like a waste of time to try and lock people out of this.
It seems like both parties would benefit from making it free anyway. As I could make Desktop plugins for Free users, which add up to more sales on the Asset store and more money for everyone…

KopiLua is managed, you don’t need native DLLs for it to work - it’s fine on Unity Basic, as well as on mobile and in the webplayer.

BTW I updated it a lot recently - it’s more stable now.

I believe the plugins are just not that thing most people think they are, not just native dlls, but kind of special dlls that use native plugin interface. All the other native dlls are not plugins and therefore should work fine in Unity Free. Unfortunately, the docs are kind of foggy.

Why report a bug!? If they know about it they might cut it now…

Same here, XInput.NET (P/Invoke style plugin) has been working fine for me since Unity 2.5 (2009).

they should cut it. when software behaves not as expected it is a bug. and beeing able to do something in unity free which should be limited to pro is not “working as expected” albeit some people may benefit from it.
some potential downsides:
UT loses some money because people don’t upgrade to pro when they can use it’s features freely
people who payed for these features are annoyed
exploiting this bug could get you in legal issues

i have no clue about eula and laws but i think it’s important for UT to know what can be done. thats why i filed the bugreport. now they can handle it to their liking, which includes to simply ignore it.

Sure, I was half joking. I think it’s a good thing to be able to use P/Invoke to make plugins for the Free version. However I wouldn’t mind paying for this feature as well. It’s just that if you make plugins, you usually want people to be able to use them. I don’t know the split between Free/Pro between Unity users but having a plugin support both makes it more visible.

EDIT: for example I can use UnityVS in the Free version, and that’s awesome for both Unity Technologies and developers

– The thing is time is money, and the fact is its not possible to stop people from using pInvoke in Mono, as Mono libraries must be open as there under GPL and so I can recompile them if I wanted to and force Unity to enable pInvoke no matter what they turn off.
Its a waste of time and money to even disable plugins for desktops because of this simple fact. It also looses money in asset store sales for people that can’t buy a plugin because its pro only. And makes it hard for me as a plugin developer to target that crowd.

In fact, Unity loses money because of limiting native plugins to Unity Pro too, because many assets sold in store will be only available for people owning a Pro license.

I’ve started a new feedback query about this, feel free to vote for it: Allow Native Code Plugins in Unity Free

Cool voted. Ad block seems to block me from voting, had to turn it off for the Unity pages.