How does Unity use C # on Android?

5

Recently I started to get interested in game development (initially for the Android platform) and that's why I met the engine Unity. I've never programmed in Java, native language of Android. However I know the C # language.

When I read more about the aforementioned engine , I noticed that it is only possible to use two languages "something derived from Javascript" and C #. Based on this, some doubts have arisen:

  • Does this mean that you can generate bytecodes versions of C # for CLR and JVM?
  • I thought it was only possible to do this through Xamarim.
  • How does the SDK issue and access the system APIs?
asked by anonymous 21.11.2017 / 13:36

1 answer

5
  

Does this mean that it is possible to generate bytecode versions from C # to CLR and JVM? I thought it was only possible to do this through Xamarim.

Unity's scripting system is an implementation that uses Mono at its base, just as Xamarin uses it. In the background is the Mono that does everything from CLR , Xamarin and Unity are layers on top that have specific functionality to interact with the operating system, being Unity more specifically for games.

Today Unity has a version of runtime and the code is converted to C ++ through IL2CPP . Unity as a platform is written almost entirely in C ++.

A normal CIL is generated that is then converted. Do not try to modify this code in C ++ that was not made for human consumption.

  

How does the SDK issue and access the system APIs?

In general, it's Unity's problem to do this and expose only its API for you to use. It can expose in a way identical to that of Android, or it can expose more in C # style, or it can do something hybrid. I do not know what their path was. The important thing is to know how to use the Unity API.

    
21.11.2017 / 14:05