Use the 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 example to understand how to develop a plug-in with Swift or Objective-C.
The Unity native plug-in example for Apple platforms project, hosted on Unity GitHub, demonstrates how to integrate native Objective-C and Swift code with Unity. This example shows integrations for Apple platforms, including iOS, tvOS, and visionOS. It highlights two different native implementations that share a single, unified C# API, allowing you to change the native back end without modifying your managed code.
The project is compatible with Unity 6000.5 or later, and works on both device and simulator SDKs.
The repository contains two 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 that illustrate different integration strategies:
+load, +initialize) and direct AppController subclassing.Both implementations expose an identical C API, ensuring C# scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary can work with either plug-in without modification. Demonstrated techniques include different initialization methods, singleton patterns, UnitySendMessage callbacks, and handling data between managed and native code.
For the complete source code and technical details, refer to Unity native plug-in example for Apple platforms (Unity GitHub).