How does Unity use C # not Android?

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

While reading more about the aforementioned engine, I checked that it is only possible to use two languages "something derived from Javascript" and C#. Based on this, some doubts arose to me:

  • that does it mean it is possible to generate versions of bytecodes from C # for CLR and JVM?
  • I thought it was only possible to do this through the Shamarim.
  • How is the issue of SDK and access to system APIs?
Author: Maniero, 2017-11-21

1 answers

Does this mean it is possible to generate versions of C # bytecodes for CLR and JVM? I thought it was only possible to do this through the Shamarim.

Unity's scripting system is an implementation that uses Mono on its basis, just as Xamarin also uses it. At the bottom is Mono that does everything from Clr , Xamarin and Unity are layers on top that have specific functionality to interact with the operating system, Unity being more specific for games.

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

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

How is the issue of SDK and access to system APIs?

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

 5
Author: Maniero, 2017-12-19 17:11:08