Advanced topic here, asking around several places, figure I’d try here to see if any unity users have any expertise to share on the matter.
I have a lot of code that I compile into its own assembly/dll and bring into my unity projects and place in the ‘Plugins’ folder. Let’s call this ‘MyAssemb.dll’. And of course I have editor specific code, and lets call that ‘MyAssembEditor.dll’.
Today, I had to split these projects into 2. This means I get 4 dll’s in total now, 2 runtime, and 2 editor only. Let’s call these:
MyAssemb.Base.dll
MyAssemb.Extended.dll
MyAssembEditor.Base.dll
MyAssembEditor.Extended.dll
I can’t just drop these new dll’s into an existing project because all the serialized data in the project that happens to reference these dll’s won’t be able to find the appropriate scripts inside them. From what I can tell, it references the script by the file it’s in, and that file is referenced by a guid.
So I thought maybe I can just merge the dll’s that are built from these divided projects back into a single dll just like it was before I had to divide the project.
I got ILMerge to do this, and the runtime dll’s merged together perfectly fine! I bring that merged dll in, and everything works correctly, the scripts that are attached to GameObjects remain in tact. Lets call the merged dll’s:
MyAssemb.Merged.dll
MyAssembEditor.Merged.dll
Problem occurs when I merge the editor dll’s. The problem is that editor dlls reference the runtime dlls. The resulting merged dll still referenced the split runtime dlls. But only the merged runtime dlls are brought into unity. And I don’t know how to make ILMerge merge together the referenced assemblies inside it.
Basically MyAssembEditor.Merged.dll still references MyAssemb.Base.dll and MyAssemb.Extended.dll. But I only have MyAssemb.Merged.dll in the unity project.
I need to figure out a way to build these divided projects into a single dll, while maintaining the appropriate references between them.