Create a native 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 for iOS and import into your Unity project.
For each native function you want to call, define an extern method in the C# file as follows:
[DllImport ("__Internal")]
private static extern float FooPluginFunction();
If using C++ (.cpp) or Objective-C++ (.mm) to implement your plug-in, declare functions with C linkage to avoid issues with name mangling:
extern "C" {
float FooPluginFunction();
}
Plug-ins written in C or Objective-C don’t need this, because these languages don’t use name mangling.
Add your native code source files to the Unity Project’s Assets
Folder.
To configure plug-in settings for iOS: