Version: 2022.1
Java and Kotlin source plug-ins
Create a Java or Kotlin source plug-in

Introducing Java and Kotlin source plug-ins

Unity supports Java and Kotlin code written in source files with .java and .kt extensions. To do this, Unity interprets each source file as an individual 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
and compiles them when it builds the Player. This type of plug-in is useful if you need to write a small amount of code for a single project. If you plan to reuse the code in multiple projects or distribute it to other people, then an Android Library Projects or Android Archive plug-ins might be more appropriate.

Additional resources

Java and Kotlin source plug-ins
Create a Java or Kotlin source plug-in