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).
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.
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.
Great article
ReplyDeleteThank you so much for your valuable feedback.
Delete