기술 자료

Unity Engine

Unity Engine

Native plug-ins

Details on using native plug-ins.
읽는 시간 1분최근 업데이트: 2일 전

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 UnityUnderstand how native plug-ins work in Unity, which forms you can import them in, and how managed code interoperates with them.
Call functionsCall unmanaged functions in a native plug-in from C#, and call back into managed code from unmanaged code.
Import unmanaged functions as C# methodsUse the
DllImport
attribute to tell the scripting runtime which native library contains an unmanaged function.
Pass data between managed and unmanaged codeExchange 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