Search Unity

Can I use DLLs in Unity free?

Discussion in 'Editor & General Support' started by medsouz, Jul 30, 2010.

  1. medsouz

    medsouz

    Joined:
    Jun 2, 2010
    Posts:
    259
    I've gotten yes and no... :(


    EDIT: Found out I can use .NET dlls without a problem if anyone knows HOW to use a .NET dll please post JS code.
     
  2. sybixsus2

    sybixsus2

    Joined:
    Feb 16, 2009
    Posts:
    943
    I already told you how in the thread you started on this subject yesterday. As for "please post JS code", I don't know what you're asking for. No code is required. You just drop it into your project, add the using directive and the DLL is available to your project. Any code beyond that is going to depend on what the DLL you imported contains.
     
  3. medsouz

    medsouz

    Joined:
    Jun 2, 2010
    Posts:
    259
    I know you told me but someone else PMed me a big thing about how you can't... :?
     
  4. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    you need pro to be able to use dll's
     
  5. sybixsus2

    sybixsus2

    Joined:
    Feb 16, 2009
    Posts:
    943
    I told you how to do it, and you're still asking how to do it because someone told you that it's not possible? How about actually following my suggested solution?

    No you don't. You only need Pro to be able to use DLLs written in C/C++. .Net Class Libraries work without Pro.
     
  6. zumwalt

    zumwalt

    Joined:
    Apr 18, 2007
    Posts:
    2,287
    managed dll's that are .net 2.0 compliant can be used in indy, unmanaged dll's require pro
     
  7. medsouz

    medsouz

    Joined:
    Jun 2, 2010
    Posts:
    259
    Okay I got the DLLs working, does anyone know how to use Tao.Lua though? Its supposed to be for Mono but I can't get any tutorials on how to make it load a file...


    Also will this work in the webplayer?
     
  8. cannon

    cannon

    Joined:
    Jun 5, 2009
    Posts:
    751
    Yes, managed DLLs work in the webplayer.
     
  9. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    tao will not work in the webplayer, no lua will actually.
    They always rely on the unmanaged lua51 dll / bundle.
     
  10. medsouz

    medsouz

    Joined:
    Jun 2, 2010
    Posts:
    259
    @Dreamora
    Thanks, I would have spent all day trying to get it to work if you didn't tell me that. :D
     
  11. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    no prob :)

    There is one way that will indirectly work but that won't be nearly as easy: IronLUA.

    with that you create a .NET assembly which you then can include like any other .net assembly in the webplayer and call code from it through your c# / js scripts you have.

    but aside of that, you will primarily be working in boo / c# / js (if you are a fan of lua or just hate js / c#, looking at boo might be a good idea. A good page on boo is http://boo.codehaus.org/)
     
  12. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    No you can't

    Attempting to use DLLImport / InteropServices on the free unity will fail. Its a pro only feature
     
  14. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
  15. carllooper

    carllooper

    Joined:
    Aug 8, 2009
    Posts:
    64
    Despite what the Unity docs imply (and many others say) you can use DLLs in the Indie version of Unity. This has always been the case for every version of Unity over the last few years.

    Using Unity Indie just means that you will need to manage integration of DLLs yourself.

    Here are some DIY tips for using DLLs with the Indie version:

    1. Ignore what Unity docs say about DLLs. Those instructions are for Unity Pro users.

    2. Make sure that your DLL is either located somewhere referenced in system path variables, or that the DLL is at the location specified in your code, relative to your host executable.

    3. Make sure hat C++ functions within your DLL are exported using either extern "C", or that you otherwise specify (in C#) the "mangled" names of the functions. You can use the Visual Studio tool "dumpbin" to identify the mangled names of functions in a DLL.

    4. For any environment (not just Unity) you will need to close the host (ie. Unity) before you can recompile any DLL it is otherwise using.

    Carl
     
  16. AnomalusUndrdog

    AnomalusUndrdog

    Joined:
    Jul 3, 2009
    Posts:
    1,553
    When I put a native (C/C++) dll in the folder where Unity.exe resides, I am able to import that plugin with non Pro, even though the console messages say otherwise. I've repeatedly told UT about this, but I never got a reply.