- Home /
The question is answered, right answer was accepted
Unity Webplayer and Dlls
Hi,
I just wanted some clarification about Unity Webplayer and Dlls. It seems to be possible the use Dlls in a Webplayer but sometimes I see that it's not possible ?
In which case we can't use Dlls for Webplayer ?
From what I think, It's not possible to load Dlls Dynamically in the Webplayer because of some security reason. But if we include the Dlls in the project there is no problems ?
From the documentation :
Note: On the desktop platforms, plugins are a pro-only feature. For security reasons, plugins are not usable with webplayers.
Thanks a lot for you clarification.
Answer by Bunny83 · Jun 13, 2013 at 08:06 AM
You have to distinguish between native code dlls and managed code dlls. Managed code dlls (.NET libraries) can be used without any problems in a webbuild as long as it's a pure managed dll and not a mixed-mode dll. So if you try to use plugins or other native code function from a dll it won't work.
100% managed dlls should always work as long as it doesn't use a class or a function that isn't supported by Unity or the webplayer. See the Mono compatibility page for a full list of all .NET classes / methods which are supported.
Thanks for you answer @Bunny83. I don't have much knowledge about dlls but $$anonymous$$anaged and Native code dlls can be done with any languages (C#, C++, C...) ?
Not really. Native code is machine code executed by your processor. Native code can do everything including evil things ;)
So called "managed code" is compiled to an intermediate language called CIL. This code has to be translated into machine code when it's executed. This translation is done by the $$anonymous$$ono framework. The webplayer has a special $$anonymous$$ono version that doesn't allow File access and many other potential harmful things.
C# is a .NET / $$anonymous$$ono language and produces "mainly" managed code. It'S possible to include so called "unsafe" sections which execute native code inside a managed application. Those aren't allowed in the webplayer.
C++ is not really bound to a certain architecture, but in most cases you produce native code. There is a special version of C++ called C++/CLI which produces managed code.
Great answer @Bunny83 and thanks a lot for your clarifications.
Follow this Question
Related Questions
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Using DLLS in a Webplayer 0 Answers
Unity web player is not installed correctly 0 Answers
Unity 4.1.2f1 Webplayer does not function offline 1 Answer
how to add a unity made game to a website (as a browser playable game)? 1 Answer