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-in code statically.
| Topic | Description |
|---|---|
| Overview of native plug-ins in Unity | How to import and use native plug-ins. |
| 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.