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 Unity compiles and creates native platform code.

Discussion in 'Editor & General Support' started by NeilDG, Sep 8, 2014.

  1. NeilDG

    NeilDG

    Joined:
    Sep 8, 2014
    Posts:
    2
    Hi,

    This is related to compiler theory and programming languages which I am curious about in Unity.

    Can someone enlighten me on how Unity actually compiles the project and converts it into its respective native platform code, say on iOS and Android. So you have a code in C#, how is it actually being interpreted when it comes to creating an iOS build and an Android build for example (which iOS is on Objective-C and Android is Java-based).

    After years of actually working with Unity, I still am not aware what kind of magic happens beneath the build process. :rolleyes:

    Been looking for this for quite a while but cannot seem to arrive on an answer.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    C# is compiled down to Common Intermediate Language and is run using the Mono Framework on most platforms (exception being WinRT platforms, where .NET is used instead). It is not converted to neither Java or Objective-C.

    Also, Unity itself is written in C++. Only a small platform specific parts are written in platform specific languages for interoping with the OS (i.e. Objective-C on iOS, Java on Android, etc).
     
  3. NeilDG

    NeilDG

    Joined:
    Sep 8, 2014
    Posts:
    2
    Thanks for leading me to the Mono framework. I guess I could learn more about here? http://www.mono-project.com/

    Can you give one good example of a platform-specific code, let's say a code specialized for Android Unity build.