13
\$\begingroup\$

IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. Note - IL2CPP is only available when building for the following platforms:

  • Android AppleTV, iOS*, Nintendo 3DS, Nintendo Switch, Playstation 4 Playstation Vita, WebGL* ,Windows Store, Xbox One

I have a project(unity 5.2) which has switched for Android deployment. I tried to switch my scripting backed from Mono2x to IL2CPP and its showing me that

IL2CPP on Andriod is experimental and unsupported

So, my simple question is that if it is still not supported then why the option has included, what is the fundamental difference between IL2CPP and Mono2x. Why I switched to IL2CPP scripting backend ? what are its pros and cons?

I have also checked in unity 5.5.2 there is not IL2CPP option in windows platform deployment.

\$\endgroup\$
13
\$\begingroup\$

Information is based on Unity version 2018.2:

Quoting the Unity manual on IL2CPP:

IL2CPP (Intermediate Language To C++) is a Unity-developed scripting backend which you can use as an alternative to Mono when building projects for various platforms. IL2CPP (An ahead-of-time (AOT) compiler) supports debugging of managed code in the same way as the Mono scripting backend.

When building a project using IL2CPP, Unity converts IL code from scripts and assemblies to C++, before creating a native binary file (.exe, apk, .xap, for example) for your chosen platform. Some of the uses for IL2CPP include increasing the performance, security, and platform compatibility of your Unity projects.

Quoting the Unity tutorial on IL2CPP & Mono:

Each Scripting Backend has benefits and drawbacks that should influence your decision on which is the right choice for your situation:

IL2CPP:

  • Code generation is heavily improved compared to Mono.
  • Debugging Script code in C++ from top to bottom is possible.
  • You can enable Engine code stripping to reduce code size.
  • Build times are longer than with Mono.
  • Only supports Ahead of Time (AOT) compilation.

Mono:

  • Faster build times than IL2CPP.
  • Supports more managed libraries due to Just In Time compilation (JIT).
  • Supports runtime code execution.
  • Must ship managed assemblies (.dll files that mono- or .net produce).

Important Points:

  • The default Target Architecture in the Android Player Settings are armv7 and x86 with the IL2CPP and Mono Scripting Backend.
  • Mono is not supported on UWP or iOS 11 and above. The default Architecture in the iOS Player Settings are armv7 and arm64 with the IL2CPP Scripting Backend.

  • UWP build only support IL2CPP and .NET, The .NET scripting backend (Deprecated ) uses Microsoft’s .NET to power scripting.

\$\endgroup\$
3
\$\begingroup\$

IL2CPP is a Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. When you choose to build a project using IL2CPP, Unity converts IL code (sometimes called CIL - Intermediate Language or Common Intermediate Language) from scripts and assemblies into C++ code, before creating a native binary file (.exe, apk, .xap, for example) for your chosen platform. Some of the uses for IL2CPP include increasing the performance, security, and platform compatibility of your Unity projects.

Source

IL2CPP is a supposedly equivalent* execution platform that is faster than mono. In this context "experimental" places a strong emphasis on the word "supposedly" in the previous sentence.

Experimental features are released for the same reason beta software is released publicly: The software is good enough to use, and the developers want bug reports and other feedback from a wide range of users so they can get to the point where the software is ready or the actual release.


*IL2CPP doesn't work for code that is used purely through reflection, which will happen when using reflection, serialization, or generics on classes that are never called directly and thus stripped from the build. The same restriction currently applies to Mono on platforms that use Ahead of Time compile restrictions.

\$\endgroup\$
  • \$\begingroup\$ So it is still not mature yet i am using 5.2 no experience about 5.5. or 5.6. additionally what are the pros n cons to shift at il2cpp? \$\endgroup\$ – Muhammad Faizan Khan Apr 29 '17 at 10:21
  • \$\begingroup\$ It is mature for some platforms. It has been around since before Unity 5 for at least IOS. I think even the Android IL2CPP is not marked experimental in the latest versions. I found the jump from Unity 4 to 5 to be slower on android until I started using the IL2CPP. It is noticeably faster on my testing devices. \$\endgroup\$ – Tartle Wizard Apr 29 '17 at 22:45
  • 1
    \$\begingroup\$ Since IL2CPP is compiling to machine code Ahead-of-Time, it has a few additional restrictions regarding reflection and use of generics. Mono's Just-in-Time compiler has the information on hand to introspect & generate the needed code on the fly, but for AoT all the needed code needs to be easy to detect at build time. \$\endgroup\$ – DMGregory Aug 9 '17 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.