Version: 2022.2
Language : English
Import an Android Archive plug-in
Native plug-ins for Android

JAR plug-ins

You can use Java Archive (JAR) plug-insA 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
to interact with the Android OS or to call methods written in Java from 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
.

Java Archive (JAR) plug-ins contain Java code that you can call from C# scripts. They’re useful if you want to interact with the Android operating system, or just call Java code from C#.

This type of plug-in is useful if you plan to reuse Java code in multiple projects, or distribute it to other people. If instead you only want to write a small amount of Java code for a single project, then a Java or Kotlin source code plug-in might be more appropriate.

Import a JAR plug-in

To import a JAR plug-in (AAR) plug-in into your Unity Project:

  1. Copy the .jar file to your Unity Project’s Assets folder.
  2. Select the .jar file in Unity and view it in the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    .
  3. In the Select platforms for plugin section, select Android.
  4. Select Apply.

Additional resources

Import an Android Archive plug-in
Native plug-ins for Android