How can a game created in Unity can run on an Andr

2020-08-19 15:17发布

问题:

I'm new using Unity and, if I understood correctly, it works using C# language. Android devices can only run Java applications cause that's the work of its virtual machine: the Dalvik. So how can this be done with the feature of this program to "compile" to Android???

回答1:

Android devices can also run native code written normally in C or C++.

The Unity application written in C# is compiled to .NET bytecodes. When Unity builds an Android app, it includes a .NET bytecode interpreter in native code, based on Mono. When you run the app, the interpreter is run to execute the bytecodes. That's how it can run on Android.