- Home /
Can I access a dll plugin from Javascript or only from c#?
After reading http://unity3d.com/support/documentation/Manual/Plugins.html, which shows how to access a dll from c#, I am wondering is there a similar process for accessing plugins from Javascript? Or can plugins only be accessed if I write a c# script?
Answer by Bwohaha · May 04, 2011 at 08:34 AM
While it says: "Plugins allow your game code (!)(written in Javascript, C# or Boo)(!) to call into native code libraries.",- plugin in the example project given is a C#-based wrapper, that is used by javascript as a method to use native code. So C# dll-access is recommended: "so it is recommended to wrap all native code methods with an additional C# code layer".
It's hard to say for certain, since they say it's only (!)recommended to use c#-wrapper, which might mean there are solutions without it... but I have found no other way so far, so I have to say that c# is obligatory.
P.S. also since one of those solutions would probably be using c# anyways, just without creating a wrapper.
Answer by Abscissa · Oct 14, 2013 at 09:41 AM
Yes. According to http://docs.unity3d.com/Documentation/Manual/Plugins.html:
Note that when using Javascript you will need to use the following syntax, where DLLName is the name of the plugin you have written, or "__Internal" if you are writing statically linked native code:
@DllImport (DLLName)
static private function FooPluginFunction () : float {};
Your answer
Follow this Question
Related Questions
DLL placement 1 Answer
Connecting to a Qpid Broker 0 Answers
Is there a way to create a C++ Managed DLL for Unity? 0 Answers
How to add a custom module to Unity? 0 Answers