Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to load external DLLs without adding them to the project

Discussion in 'Editor & General Support' started by Magasenakwa, Oct 23, 2019.

  1. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    91
    I am trying to make use of 3rd party DLLs which are installed via the company's own installers into subfolders inside C:\Windows\Microsoft.NET\assembly\.

    Part of their licensing terms is that the DLLs may not be distributed/bundled along with 3rd party apps but must be installed via their installers directly.

    It seems that Unity doesn't have a system in place to load DLLs that are visible to Windows (Winforms apps can use the DLLs without it being included with the app) but Unity refuses to build unless they are included and when they are included the .NET4.6 DLLs all say "This DLL will not be included because it has errors. Is the assembly missing or incompatible with the current platform?" (or something like that). I have verified that I am using .NET4.x but still, these .NET 4.6 built libs complain about the version not being correct (?????).

    I tried using the RSC file to load the DLLs from a folder parallel to Assets and this get rid of all compiler errors except for:
    Code (csharp):
    1. Assembly 'Library/ScriptAssemblies/Assembly-CSharp.dll' will not be loaded due to errors:
    2. Assembly 'Library/ScriptAssemblies/Assembly-CSharp-Editor.dll' will not be loaded due to errors:
    3. Reference has errors 'Assembly-CSharp'.
    Even if I managed to get past this and get the project to compile again I am still violating the "You are not allowed to distribute/bundle our DLLs" licensing terms so.... How do I link to external DLLs? :(

    The answer I keep getting is "First step is to drag them into your project"... That is not gonna help me, unfortunately. Is there a way to do this?

    Thanks
     
  2. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    You should think about dlls as mods. Look around forum in that context.
     
  3. Magasenakwa

    Magasenakwa

    Joined:
    Oct 13, 2018
    Posts:
    91
    On the one hand that sounds like very good news as in "It is very much possible"
    On the other hand it leaves me scratching my head in confusion as I wonder "What did he just say?"

    Do a forum search for "Mods"? That could lead to an answer? Hmmm.... I guess I have nothing to loose by trying.

    Thanks
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,754
    Mods and modding. There is no need going here in details, because there is tons of discussions on forum on the subject. Also, depends on applications and restrictions, you will need chose relevant solution. Which is hard to deduct from initial post.

    You need check, which approach is most suitable. Adding another keyword, reflections.

    Is just quite wide topic on itself.