Skip to content

Il2CppInterop

What is Il2CppInterop

Il2CppInterop is a framework for bridging together Unity's Il2Cpp and .NET's CoreCLR runtimes.

The framework allows the use of Il2Cpp domain and objects in it from a managed .NET domain. This is extremely important for the Unity modding community and has been a key pillar of most mod loaders for several years.

Version 1 Contributions

I did not create Il2CppInterop, but I am a long-time contributor, both to Il2CppInterop and its predecessor Il2CppAssemblyUnhollower. Here are a few of my more notable contributions:

Version 2

Despite the unquestionable usefulness of Il2CppInterop v1, it has some friction points:

  • Inheritance - Interfaces are classes; abstract classes are not abstract; virtual methods are not virtual.
  • Non-blittable structs - They are generated as classes, backed by a pointer to a boxed object.
  • Object type - Objects are returned from generated interop methods as the declared return type, rather than the object's actual type.

I rewrote most of Il2CppInterop to address the above issues and create a (nearly) perfect type system that faithfully models the underlying system.