ποΈ Supported Unity versions and platforms
HybridCLR has stably supported the 2019.4.x, 2020.3.x, 2021.3.x, and 2022.3.x series LTS versions, and supports mainstream Win, MacOS, Android, iOS, and WebGL platforms.
ποΈ Install
Install a compatible Unity version
ποΈ Settings
After installing the com.code-philosophy.hybridclr package, you need to set the relevant parameters correctly. Detailed configuration related documents can be found in hybridclr_unity package introduction.
ποΈ Configure Assemblies
Generally speaking, the hot update code must be separated into an assembly to facilitate hot update.
ποΈ Load And Run Code
Load assembly
ποΈ Building Pipeline
Due to the requirements of the hot update itself and some limitations of Unity resource management, some special processing is required for the buiding workflow, which is mainly divided into several parts:
ποΈ Publish WebGL Platform
Due to the particularity of the WebGL platform, a separate document introduces how to release the WebGL platform. This document is published on the hybridclrtrial project (github gitee ) process.
ποΈ Code Stripping
Unity uses Code Stripping technology to help reduce the package size of the il2cpp backend. If anti-cutting processing is not performed, since there are generally not many codes in the AOT main project, a large number of C# types and functions are
ποΈ MonoBehaviour Support
HybridCLR fully supports the hot update MonoBehaviour and ScriptableObject workflow, that is, you can add a hot update script on the GameObject in the code or mount it directly on the resource.
ποΈ AOT Generic
There are two types of generic features in the CLR: generic types and generic functions. Generics are an extremely widely used feature in C#. Even a usage that does not explicitly contain generics may imply generic-related definitions or operations.
ποΈ Method Bridge
Two-way function calls are required between the Interpreter of HybridCLR and AOT. For example, the interpreter calls the AOT function, or the AOT calls back the interpreter through the interface interface or delegate.
ποΈ DOTS Support
The initialization timing of TypeManager in DOTS is too early, and it does not support dynamically registering Component and System types. To ensure the normal operation of the hot update module in the DOTS system, modifications need to be made to the DOTS source code to adjust the initialization timing of the World.
ποΈ Memory and GC
object memory size
ποΈ Performance
Although HybridCLR is also interpreted and executed, both theoretical principles and real machine test data show that HybridCLR has greatly improved performance (several times or even dozens of times) compared to the currently popular hot update solutions such as Lua and ILRuntime.
ποΈ Impact On the App Size
After integrating HybridCLR, there is a slight increase in package size, mainly due to the following components:
ποΈ Unsupported Features
Features that are not in the restrictions are supported by HybridCLR, please don't ask if HybridCLR supports a certain feature.
ποΈ Hybridclr Package
com.code-philosophy.hybridclr is a Unity package that provides the Editor workflow tool script and Runtime script required by HybridCLR. with the help of
ποΈ Best Practices
Unity version recommendation
ποΈ Migrate from netstandard to .Net Framework
During the building pipeline, Unity will convert all references to netstandard.dll into final references such as mscorlib.dll, resulting in original code
ποΈ Work with lua/js/python
Some projects have already been launched, and most of their codes have been implemented in lua; or some new projects have been developed in lua, and they cannot completely switch to full C# development, but hope
ποΈ Code Architecture And Version
The complete HybridCLR code consists of three repositories:
ποΈ Source and Debug
HybridCLR module introduction
ποΈ il2cpp Bugs
Contravariant covariant generic interface call error