Unity supports native plug-ins, which are libraries of unmanaged code written in languages such as C, C++, and Objective-C. Plug-ins let the managed code you write in C# to call functions from these libraries. This feature allows you to integrate middleware libraries and to reuse existing C/C++ code. You can use both precompiled libraries and source code files as plug-ins. When you use source code, Unity compiles and links the plug-inA set of code created outside of Unity that creates functionality in Unity. There are two kinds of plug-ins you can use in Unity: Managed plug-ins (managed .NET assemblies created with tools like Visual Studio) and Native plug-ins (platform-specific native code libraries). More info
See in Glossary code statically.
| Topic | Description |
|---|---|
| Overview of native plug-ins in Unity | How to import and use native plug-insA platform-specific native code library that is created outside of Unity for use in Unity. Allows you can access features like OS calls and third-party code libraries that would otherwise not be available to Unity. More info See in Glossary. |
| Call functions | How to call unmanaged functions in a native plug-in from managed C# code and how to callback from unmanaged code to managed code. |
| Pass data | How to exchange data between managed and unmanaged code. |
Note: Unity also exposes a set of native APIs that allow you to create and use plug-ins that interact directly with Unity Engine systems such as rendering, profiling, and logging. When you use these APIs, your native plug-in can interoperate with the Unity runtime directly without going through managed application code. Unity discovers and loads plug-ins that use this API automatically. For more information, refer to Native plug-in APIs. For an example of a native plug-in that uses these APIs, refer to Native Rendering Plugin.
For platform-specific information on native plug-ins, refer to the relevant section under Platform development.