Tekkaman

导航

 

Plugins in Unity

  In Unity, you normally use scripts to create functionality but you can also include code created outside Unity in the form of aPlugin. There are two kinds of plugins you can use in Unity: Managed plugins and Native plugins.

  Managed plugins is accessible to the standard .NET tools that Unity uses to compile scripts.

  Native plugins are not accessible to Unity’s tools in the way that managed libraries are.

 

  Unity has extensive support for Plugins, which are libraries of native code written in C, C++, Objective-C, etc. Plugins allow your game code (written in Javascript, C# or Boo) to call functions from these libraries. This feature allows Unity to integrate with middleware libraries or existing C/C++ game code.

  Note: For security reasons, plugins are not usable with webplayers.

  In order to use a plugin you need to do two things:

  • Write functions in a C-based language and compile them into a library.
  • Create a C# script which calls functions in the library.

  The plugin should provide a simple C interface which the C# script then exposes to other user scripts. It is also possible for Unity to call functions exported by the plugin when certain low-level rendering events happen (for example, when a graphics device is created).

 参考:http://docs.unity3d.com/Manual/Plugins.html

posted on 2014-09-15 19:33  Tekkaman  阅读(667)  评论(0编辑  收藏  举报