Version: Unity 6.6 (6000.6)
Language : English
Managed plug-ins
Introduction to native plug-ins in Unity

Native plug-ins

Unity supports native plug-ins, which are libraries of unmanaged code written in languages such as C, C++, and Objective-C. Native plug-ins let the managed C# code you write call functions from these libraries, so you can integrate middleware libraries and reuse existing C and C++ code. You can use both precompiled libraries and source code files as native plug-ins.

Unity also provides native APIs that let your plug-ins interact directly with Unity engine systems such as rendering, profiling, and logging, without going through managed code. For more information, refer to Native plug-in APIs. For platform-specific information on native plug-ins, refer to the relevant section under Platform development.

Topic Description
Introduction to native plug-ins in Unity Understand how native plug-ins work in Unity, which forms you can import them in, and how managed code interoperates with them.
Call functions Call unmanaged functions in a native plug-in from C#, and call back into managed code from unmanaged code.
Import unmanaged functions as C# methods Use the DllImport attribute to tell the scripting runtime which native library contains an unmanaged function.
Pass data between managed and unmanaged code Exchange primitives, structures, arrays, and strings between managed C# code and unmanaged native code.

For platform-specific information on native plug-ins, refer to the relevant section under Platform development.

Additional resources

Managed plug-ins
Introduction to native plug-ins in Unity