Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How does Unity export to Android Studio exactly?

Discussion in 'Android' started by Chris9465, Dec 4, 2020.

  1. Chris9465

    Chris9465

    Joined:
    Nov 3, 2020
    Posts:
    21
    I know how to export a project to Android Studio and get it running just fine. However, when I was pouring over the files in Android Studio, I got to thinking how exactly does Unity translate/compile everything over? Unity runs on Mono, which was .NET for Linux essentially. Now I am wondering how it translates that into java code for Android.
     
  2. Chris9465

    Chris9465

    Joined:
    Nov 3, 2020
    Posts:
    21
    After much research, I found it has a lot to do with the Java Native Interface, which allows you to port things over essentially to Java from C#. Unfortunately, this is all buried in Java packages which would need to be decompiled (Unity uses FernFlower decompiler)
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,638
    Java code is not translated, it goes into your apk. JNI is used for interop between it and native code.
     
    Chris9465 likes this.