- Home /
Custom DLL: mybuildcode.dll is identical to mybuildpluseditor.dll, but does not work in build
Hi all,
here's my situation: I've moved all my core code into a separate project and successfully built it as a .dll Of course, I have to build two separate .dll files, one for build (with no UnityEditor.dll refernece), and one for editor.
When I am testing this setup through editing and build, editing works just fine. When I make a build (and the build.dll gets included, rather than editor.dll, as it should be), the build succeeds but after running the build, in output.log, all components on game objects show up as missing.
In looking at the meta files and comparing guids, it appears that .unity and .prefab files store a reference to my dll-defined Monobehaviours as a reference to the .dll itself.
For example, MyTestBehavior.cs : Monobehaviour is defined in dll. it is added to a gameobject in scene. in the .unity file for that scene, a reference can be seen to guid: the_editor_dll_guid_here
since the build.dll has a different guid, it would seem that references are lost in the build, even though the code is there. I attempted to manually find-and-replace all guids from editor.dll to match build.dll, then make the build, and then switch them back to continue on in the editor. but when i do that, i run the build and get the following in output.log:
The file 'C:/PathToBuild/test_Data/level0' is corrupted! Remove it and launch unity again! [Position out of bounds!]
How can I create a build/editor dll that are identical, and swap them on build successfully?
NOTE: It is not feasible for me to re-write my core library to have 100% separation between build and editor dlls. I have a lot of single lines within methods contained in #if UNITY_EDITOR defines, which get stripped or included on building a dll. I mean, sure, I could do it. But this is supposed to save me time and sanity ;)
Thanks in advance