leanclr-unity(包名 com.code-philosophy.leanclr)是 LeanCLR 的 Unity 集成包:在发布 WebGL / 小游戏等平台时用 LeanCLR 自动替换 IL2CPP。
在配合 aot.xml / PGO 选择性 AOT 的前提下,相对 IL2CPP 全量 AOT 典型表现为:
- AOT 代码体积:托管代码编译产生的 AOT 原生代码可减少约 70%–90%(仅对热点/必要方法 AOT 时,整体性能影响可控)
- 内存:虚拟机内存约减少 20%–35%,托管内存亦有少量下降
- 大型项目:支持 延迟加载 与 热更新,在符合小游戏包体要求下可支撑数十 MB 级托管代码
- GC:准确式 Mark-Sweep GC,回收效率更高,GC 更快
详见 Unity 集成文档。
完整文档站点:https://doc.leanclr.com
| 主题 | 链接 |
|---|---|
| Unity 集成总览 | doc.leanclr.com/docs/ecosystem/unity/ |
| 安装 | 安装 |
| 项目设置 | 项目设置 |
| 概念辨析(AOT / 延迟加载 / 热更新) | 概念辨析 |
| 构建与 CompileDll | 构建 |
| 代码热更新 | 热更新 |
| 运行时与 AOT | LeanCLR 文档首页 |
在 Unity Package Manager → Add package from git URL 中填入:
https://github.com/focus-creative-games/leanclr-unity.githttps://gitee.com/focus-creative-games/leanclr-unity.git
安装后打开 LeanCLR → Settings... 启用集成,按文档发布 Player 即可。示例工程:leanclr-unity-demo。
| 仓库 | 说明 |
|---|---|
| leanclr | LeanCLR 运行时与工具链 |
| leanclr-doc | 文档站源码 |
| hybridclr | Unity 全平台原生 C# 热更新(定位互补) |
- 邮箱:
leanclr#code-philosophy.com - Discord:https://discord.gg/esAYcM6RDQ
- QQ 群:1047250380