Unity's Back-end System


Overview:

This technical content related to Unity’s Backend System like How unity compile the code? , How unity build code for different platforms?


Step-1: Convert Source code to Engine code



- We are writing the code in c# it’s called source code.

- Always source code converted into engine code through the compilation process.

- First, all the C# scripts compiled into CIL (Common Intermediate Language).




- All c# code is known as source code and CIL code known as Managed Code.

Managed Code: Managed code easily converted into different-different languages and able to prepare engine code.

- C# easily maintain managed code, so that it is also known as Mixed Programming Language.

 

Step-2: Types of Compilation

There are two types of the compilation process for c#,

  • AOT [Ahead Of Time]
  • JIT [Just In Time]

- Both compilation processes are starting compilation process depending on the target hardware like android, ios, play-station, etc.


1) AOT [Ahead Of Time] Compilation:

- Ahead Of Time compilation means compiling application during the build process.

- It’s also known as static compilation.

- All the IOS devices use the AOT compilation process because Ios doesn’t allow dynamic compilation.


2) JIT [Just In Time] Compilation:

- Just In Time compilation means compiling applications when running the application on the device.

- It’s also known as dynamic compilation.

Both the compilation process has its own back and forth, so which one is best it is a debatable topic because of both compilation capable of optimization and build code in a better way.

In Unity we can choose any of the compilation processes as per our requirement.


Step-3: Engine Code

- Compilation process build up engine code and finally, it will run on a device, But…

  •  Complexity Level:

- Unity the engine is not developed in C#, it is developed in C++ like other software.

- So that here C++ engine code needs to communicate with C#’s engine code.

- Managed code integrated with “Manage Run-time”,

            Manage Run-time is a security mechanism before run/compile process and throw an exception if any bug or error in managed code.

 


Step-4: Marshalling

- Managed Run-time code(C#) communicating with Unity Engine code (C++) it’s called Marshalling.


Step-5: Build Process

- After completion of marshalling, it will handle lots of complexity during converting code C# into C++ in backend for all the supported platforms like Android, IOS, Windows, Play-station, and many more.

- Finally engine code build up with security level and bug and exception free and ready to build on the device.





Comments

Post a comment

Popular posts from this blog

GDLC [Game Development Life Cycle]

DEVELOPER’S GUIDE TO UNITY3D MMO WITH NODE.JS USING SOCKET.IO

Unity Tiny | Tiny Mode | Instant Games | Playable Ads

DOTS - Unity3d

NAMING CONVENTIONS | CODING CONVENTIONS | PROGRAMMING GUID

Unity3d – Attributes

ANDROID GO - LIGHTER, SMARTER & OPTIMIZED ANDROID OS