Legacy Documentation: Version 2018.1 (Go to current version)
Loading Resources at Runtime
Plugin Inspector
Other Versions

Plugins

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

Managed plugins are managed .NET assemblies created with tools like Visual Studio. They contain only .NET code which means that they can’t access any features that are not supported by the .NET libraries. However, managed code is accessible to the standard .NET tools that Unity uses to compile scripts. There is thus little difference in usage between managed plugin code and Unity script code, except for the fact that the plugins are compiled outside Unity and so the source may not be available.

Native plugins are platform-specific native code libraries. They can access features like OS calls and third-party code libraries that would otherwise not be available to Unity. However, these libraries are not accessible to Unity’s tools in the way that managed libraries are. For example, if you forget to add a managed plugin file to the project, you will get standard compiler error messages. If you do the same with a native plugin, you will only see an error report when you try to run the project.

This section explains how to create plugins and use them in your Unity Projects.


  • 2018–03–19  Page amended with limited editorial review

  • MonoDevelop replaced by Visual Studio from 2018.1

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答