- Home /
C# dll "MissingMethodException" - Before first recompile
Hi
I'm using a 3rd party C# dll in my project. It works great most of the time, I can use it without anything throwing errors. But if I have just opened Unity, and click play. It will throw a MissingMethodException when it tries to access some function from the dll. Then, if I just change the name of a folder, make a small edit to a script, or something else which causes scripts to be recompiled, it works perfectly again until I restart Unity. If I try to build before unity has recompiled anything, I get compiler errors saying much the same thing as the MissingMethodException (but if it has recompiled, it works great).
I can solve this by putting the .dll file in the Assets/Plugins folder. However I cannot do that since I am including this in a package which is to be released on the Unity Asset Store.
So my questions are, why does it fail before any recompilation has been done. Shouldn't Unity detect the dll? And is it possible to have a Plugins directory in a package released on the Asset Store (which works), or another way of making sure the dll is compiled before the rest of the code?
I cannot but my whole package inside the Plugins or Standard Assets folder because I also need an Editor folder.
If this cannot be done, I am asking all Unity developers out there to improve on their compilation order system so we can manually specify compilation order for certain folders.
I do have the source code for the dll, but it really seems very ugly to paste that into the project, especially since I will have to edit a lot of defines to make it work properly.
Thanks in advance!
Another option would be to be able to include multiple separate folders in the unitypackage uploaded to the assetstore (for example Assets/$$anonymous$$yPackage, and Assets/Plugins/$$anonymous$$yPackagePlugins). But if I understand correctly, that is not possible?
Of course, another option would be to add an installer editor script which all editors prompt you to run after importing the package to move folders to more compatible places (dlls to Assets/Plugins for example). But that seems really ugly.
Answer by TowerOfBricks · May 25, 2012 at 03:58 PM
Okay... This is really weird, but the issue seems to have gone (never know) when I changed the dll name from JsonFx.Json.dll to JsonFx.dll... And it is weird because I have another dll which I use (though later in the code than the first one, so it wasn't called before) and the name of that dll is Ionic.Zip.Reduced.dll and that works, when I thought it was the . (dot) in the name that did it... Anyway, it seems to work now, but I still think that Unity dev should implement a way we can define compilation order manually.
Ok, tried to change the name back -> error comes back again. But I did some more experimenting, and it seems like if I name the dll to a namespace in the dll (like JsonFx.Json, that is a namespace in the dll) the error is thrown, but if I name it to something else with dots in the name (like JsonFx.Random), the error is not thrown.