- Home /
Can't load type from DLL.
Hello,
I wrote a DLL named "GameInput.dll" that references "DirectInput.dll". When I put "GameInput.dll" into Unity and add a reference to Visual Studio I gain access to all of the code in "GameInput.dll". Although I don't get any errors in Visual Studio when I go back to Unity I am getting a "TypeLoadException: Could not load type from assembly" error. If I go back to "GameInput.dll" and remove all usages of the "Microsoft.DirectX.DirectInput" namespace it removes all errors in Unity. Does anyone know what the problem is?
Thank you
Answer by Bunny83 · Aug 09, 2014 at 11:58 PM
Do you have the dll that contains the "Microsoft.DirectX.DirectInput" namespace in your project as well? Unity doesn't use the .NET framework. Everything has to be included in your probject. Unity has the core of the Mono framework (mscorlib.dll, System.dll, ...) available, but anything that goes beyond need to be placed in the plugins folder of your project, so it will be included in your project.
If you place a DLL into the plugins folder you never have to add a reference manually. Just let Unity re create the csproj file. Unity will add all references automatically.
I added the dll that contains the $$anonymous$$icrosoft.DirectX.DirectInput namespace and still no dice. Unity adds the reference to my dll but not the DirectInput one. The file also has a different icon than my dll. $$anonymous$$y dll has a blank page while the DirectInput one has a set of gears.
I am now getting could not load file "$$anonymous$$icrosoft.DirectX.DirectInput" or one of its dependencies. Am I missing another DirectX dll?