HybridCLR Documentation

repository·main·Indexed 27 days ago

https://github.com/focus-creative-games/hybridclr

A high-performance C# hot-update solution for Unity that converts the IL2CPP AOT runtime into a hybrid AOT + Interpreter runtime. It enables dynamic assembly loading across all IL2CPP-supported platforms, including Android, iOS, Consoles, and WebGL. Supports Unity versions 2019.4.x through 6000.x.y, featuring Differential Hybrid Execution (DHE) and a companion lightweight implementation called LeanCLR for WebGL and mini-game platforms.

Tokens
772
Snippets
0
Records
6
Agent score
43%

What's inside HybridCLR

  1. Overview of HybridCLR

    main

    HybridCLR is a high-performance, low-memory, near-zero-cost C# hot-update solution for Unity across all platforms. It transforms the standard IL2CPP AOT (Ahead-of-Time) runtime into a hybrid AOT + Interpreter runtime. This allows for native support of dynamic assembly loading, enabling hot updates on Android, iOS, Consoles, WebGL, and other IL2CPP-supported platforms.

    Key benefits include:

    • Seamless Workflow: Highly compatible with Unity's workflow, supporting MonoBehaviour, ScriptableObject, and DOTS.
    • Full C# Support: Supports generics, reflection, inheritance, and multi-threading (including volatile, ThreadStatic, and async Task) without requiring special code generation.
    • High Performance: Uses a highly efficient register interpreter and a unique Differential Hybrid Execution (DHE) technology that runs unmodified functions in AOT mode and modified/new functions in interpreter mode.
    • Memory Efficiency: Hot-update classes occupy the same memory space as standard C# classes.
  2. Explore LeanCLR for mobile and mini-games

    main

    If you require a complete, compact, and open-source CLR implementation that can be embedded independently (rather than just an interpreter module for il2cpp), use LeanCLR.

    LeanCLR is suitable for mobile and mini-game platforms and can replace il2cpp as the runtime for Unity when publishing to WebGL and mini-game platforms, which helps reduce package size and memory usage.

  3. LeanCLR for WebGL and Mini-Games

    main

    If you require a lightweight, compact CLR implementation suitable for mobile or mini-game platforms (where resource constraints are high), use LeanCLR.

    LeanCLR is a lean CLR implementation that supports the AOT + Interpreter hybrid execution mode. It can be used as a standalone runtime or as a replacement for IL2CPP when deploying Unity (Tuanjie Engine) to WebGL and mini-game platforms, significantly reducing package size and memory overhead.

  4. Get started with HybridCLR

    main

    To integrate HybridCLR into your Unity project, follow the official guides and quick start documentation:

    HybridCLR is designed to be seamless, allowing hot-update code and AOT code to work together without special code generation or coding restrictions for most use cases.

  5. Supported Unity Versions and Platforms

    main

    HybridCLR supports the following Unity environments:

    Unity Versions:

    • 2019.4.x
    • 2020.3.x
    • 2021.3.x
    • 2022.3.x
    • 2023.2.x
    • 6000.x.y (all LTS versions)

    Platforms:

    • All platforms supported by IL2CPP.
    • Unity China (Tuanjie Engine).
    • HarmonyOS (鸿蒙) platforms.