- Home /
How to use dll in webplayer?
Hello guys,
I am with a big problem, I need to build a project and it need to be WebPlayer.
There is a plugin from AT&T, and this plugin has a dll ( the dll does not access anything from the user, does not make bad requests neither other bad things). Basically, we only need to call two functions from inside the dll and these two functions only request things from the AT&T server, and do not access anything inside the user's machine.
When I try to build the project I get the following errors:
Error building Player: Extracting referenced dlls failed.
and
ArgumentException: The Assembly System.Web is referenced by ATT_MSSDK. But the dll is not allowed to be included or could not be found. UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/AssemblyHelper.cs:106) UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1 alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2 cache, BuildTarget target) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/AssemblyHelper.cs:109) UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, BuildTarget target) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/AssemblyHelper.cs:141) UnityEditor.HostView:OnGUI()
What I can do to solve it? Thank you guys!
As per this thread, the WebPlayer should allow DLLs that run $$anonymous$$ono-compatible managed code; any DLL that runs native code will be blocked.
I already read this thread, but I do not know how to be sure if the dll is managed or native.
Answer by tanoshimi · Jul 21, 2014 at 07:48 PM
Sounds like this is a native code dll, which can't be included in a webplayer build: http://docs.unity3d.com/Manual/Plugins.html
The only dlls that can be used in webplayer are pure managed code (i.e. a compiled .NET library).
Is this a public ATT dll? Which one? It might/should specify in the documentation.
@Dalmar: Speech recognition most likely will require some native code. In the webplayer you would need to use Unity's microphone interface since that's the only way to get the needed permission from the user. $$anonymous$$ost speech recognition libraries use some kind of native audio interface which isn't allowed in a webplayer. Only Unity's built-in interface will work in the webplayer since it requires user authorisation to record anything.
Otherwise it would be possible to embed a hidden webplayer in a website and the webplayer could record the users microphone / webcam and send that information over the net without the users knowledge.
If it's native code, no - there's no way to make it work. This is not a technical limitation, it's a deliberate security feature to disallow this code, as @Bunny83 explained. If any "workaround" were known, the webplayer would be patched to prevent that workaround.
@Dalmar - so, add the DLL into the project and make a web player build. If jt works, the DLL is managed code. If it doesn't work, the DLL is native code and cannot be used with the web player. If the build fails, then the DLL cannot be used. There is no trick/fix/beta update/solution.
Answer by Bunny83 · Jul 21, 2014 at 08:38 PM
Just download ILSpy and try to open the dll by dragging it into the assembly list on the left side. If it is a managed DLL it should be possible to decompile the DLL. However, even if it is a managed DLL, it could still be a mixed mode DLL, so it contains managed and native code. Such DLLs aren't allowed either since any kind of native code can't be included into a webbuild.
If it is a pure managed code DLL it's still possible that the DLL uses classes or methods which aren't supported in a webbuild for security reasons. Which classes (and methods of those) are cupported can be seen here: MonoCompatibility. This is a full list of all classes of the .NET framework which are supported / partly supported by Unity. If something is red in the webplayer column you can't use it and you can't do anything about it.
I tested and was possible to decompile the DLL.. you said that it can be mixed... How can I be sure?
Well, i guess you use this one:
https://developer.att.com/sdks-plugins/att-sdk-for-unity
The whole "plugin" is just a wrapper for either an online speech recognition service by AT&T or it requires the service to run locally. Anyways it uses classes from the System.Web assembly which isn't allowed in the webplayer. It also has tons of other dependencies on other assemblies which aren't allowed in the webplayer.
I would say this plugin simply isn't supported for webbuilds. Since you payed for the plugin you should contact AT&T and ask them as this is a problem with the plugin, not Unity.
Yeah... I use this one. I already contact AT&T and Unity, I am waiting for answers, thank you!