Skip to content

Latest commit

 

History

History
37 lines (24 loc) · 1.36 KB

Integration-API.md

File metadata and controls

37 lines (24 loc) · 1.36 KB

Integrating Il2CppInterop into plugin loaders

Note: This guide is intended for plugin loader developers and maintainers. Plugin developers may refer to other guides.

Generating proxy assemblies in loaders

TODO: Expand

Assembly generation can be done either via the CLI or directly via Il2CppInterop.Generator package.

Example of Il2CppInterop.Generator usage:

var opts = new GeneratorOptions
{
    GameAssemblyPath = GameAssemblyPath, // Path to GameAssembly.dll
    Source = sourceAssemblies, // List of Cpp2Il dummy assemblies loaded into Cecil
    OutputDir = IL2CPPInteropAssemblyPath, // Path to which generate the assemblies
    UnityBaseLibsDir = Directory.Exists(UnityBaseLibsDirectory) ? UnityBaseLibsDirectory : null // Path to managed Unity core libraries (UnityEngine.dll etc)
};

Il2CppInteropGenerator.Create(opts)
                      .AddInteropAssemblyGenerator()
                      .Run();

// Dispose of sourceAssemblies, etc cleanup

Logging is supported via .AddLogger(ILogger) helper function.

Initializing the runtime

Once all assemblies are generated and loaded, you can initialize the Il2CppInterop runtime. The runtime is available via Il2CppInterop.Runtime package.

Example: