- Home /
Unable to load assembly without recreating project
So I have a Kinect v2 preview kit, and I have been trying to get it to work with unity. After trying a few different approaches, I settled on building a .Net remoting application which will be able to send the data from the Kinect to Unity without having to use a wrapper to access the Kinect within unity. To make this work I had to create a Remotable object class which I named RemotableType. I then use the Visual Studio C# compiler to compile RemotableType.cs into RemotableType.dll. I then run a server application which uses RemotableType.dll, and access that server within Unity using my client.cs script. All of this is working fine for the most part. I am able to get the data I need from my server to my client in Unity.
Now the issue at hand: say I open my project up the next day to work on it, and I need to make a change to RemotableType.cs. I make the change, recompile the dll, and replace the outdated dll's in my server application and unity's assets folder. I then get a type load error from the Unity compiler which claims that it is unable to load RemotableType from assembly RemotableType.dll. I have tried many different things to get rid of the error including: recreating the scene file, deleting and re-adding the dll, and recompiling in monodevelop. Nothing works except for creating a brand new project and copying the assets from the old project into the new. Then the internal compiler error goes away, and the project works as intended.
My only guess as to what is happening is that there is some kind of metadata kept on the imported assemblies that is telling Unity that the new version of remotabletype.dll is not the correct assembly. I'm hoping someone here who knows a bit more about how Unity compiles its projects could shed some light on this issue. As you can imagine, it is a bit of a pain to have to recreate a project every day that I want to work on it.
Unity does create those .meta files for each asset in your project folder. Have you tried deleting the .meta file for your .dll when updating?
I tried removing all the metadata files in the assets folder, but Unity just recreated them and still gave the error. So I guess I need to figure out what is different about creating a whole new project and getting rid of asset metadata and reimporting the assets.