Simply Exploration of Unity YooAsset + HybridCLR Hot Update
Written before
My strange tech stack beckons for a strange summer internship. To summarize, I’m currently leading a small game project as a technical artist: writing the design plan to create the project, designing the functional architecture, and managing the art. While waiting for art assets, I got really bored, so I casually drew some UI for the project then also trying to bulid a hotfix system for the project, which also helps establish standards for subsequent code and art assets.
Preparation
Preliminary research
Hot updates can be categorized into resource hot updates and code hot updates. Currently, resource hot updates are based on AssetBundles. Because AB package management is cumbersome, Addressable and YooAsset have emerged as extensions. Companies seem to have adapted these solutions for resource hot updates. Addressable is said to have numerous pitfalls, leading to the latter being chosen. For code hot updates, there are Xlua, ILRuntime, InjectFix, and HybridCLR. Xlua, which was previously used for injection, is not Update-friendly. ILRuntime seems acceptable but also requires instrumentation. InjectFix is suspected to be Xlua Plus, but HybridCLR’s code consistency and native performance completely overwhelm the competition.
Resource hot update | Asset Bundle | Addressable | YooAsset |
---|---|---|---|
Introduction | Unity’s traditional resource packaging and management solution. | Unity’s recommended resource management solution, managing resources by marking them as Addressable. | A third-party plugin that adds more flexible hot update and resource management features. |
Advantages | Native Unity support, high stability. | Automatically manages resource dependencies. | Simplifies the resource hot update process, supporting resource subpackaging and dependency management. |
Disadvantages | Relatively complex resource management, manual dependency path management, and cumbersome packaging and update processes. | Complex configuration, especially for multi-platform or large projects. | Requires third-party support and may have compatibility issues. |
Hot Code Update | xLua | ILRuntime | InjectFix | HybridCLR |
---|---|---|---|---|
Hot Update Granularity | Script File Level | Class Method Level | Function Level Patching | Assembly Level |
Performance Loss | High (Lua Virtual Machine) | Medium (Parsing and Execution) | Low (Partial Replacement) | Very Low (Primarily AOT) |
Development Cost | Requires Wrap File Maintenance | Requires Binding to Code Generation | Requires Instrumentation Configuration | No Integration Required |
Applicable Phases | Content Updates During Operation and Maintenance | Functional Iterations During Development | Emergency Fixes During Operation and Maintenance | Full Lifecycle |
Package preparation
Both YooAsset and HybridCLR can be found on the official website and can be built into the project by quick start documentation. I won’t go into too much detail here (the logic of the demo project in YooAsset is quite clear, but I’m not used to the state machine and gave up directly). It is worth mentioning that YooAsset can’t pack things in the StreamingAssets and HybridCLR packages the assembly into a dll and then seals it into bytes and passes it into the package. In this case, the project hierarchy plan is roughly as shown in the figure below (the project is in weak network mode, you can play without a network and update with a network)
1 | Assets |
Pipeline
The general process for hot updating is to first hot update the HybridCLR code (replacing the hot update bytecode), then hot update the YooAsset assets (placing them in the yoo folder). I’ve merged the initialization and resource acquisition processes for YooAsset and HybridCLR into the HotUpdateManager. Note that the hot update code must be obtained from YooAsset; comment out the overridden sections in the code. If you’re hot updating prefabs mounted in the scene, it’s also recommended to pre-update the prefabs after the code hot update.
1 | void InitGame() |
The collector settings of YooAsset are as follows

Collect art resources, scenes, and hot update programs separately
Then the execution logic of the code is
1 | 1. InitHotUpdate() // Initialize YooAssets. The initialization process varies depending on the mode (standalone, networked, or web). |
After that, verify the hotfix using a local server. I personally use nginx. Once downloaded, unzip it and use it (you may need to configure the port yourself). First, click HybridCLR/ComplieDll/ActiveBuildTarget to generate the dll file (the first time, you need to click HybridCLR/Generate/All). Then, add a .bytes suffix to the hotfix code bundle and place it in the specified location. Then, click YooAsset/AssetBundles Builder/Click Build. Place the generated files in the HTML folder and configure the port index in the injection file.

Local server and hotfix manager configuration to collect art resources, scenes, hotfix assemblies
To verify the ability to hot-update resources and code simultaneously, I found a picture of a fierce cat and let gpt wrote a screen movement script. When packaging, I only added an empty scene without any other resources, and when hot-updating, I added all the resources. After several days of debugging, I finally got this process working (I did it!).
Conclusion
Coordinating YooAsset and HybridCLR may seem simple, but there are still many pitfalls. The subsequent process settings and resource specifications also require careful attention. The official manuals and demo projects are helpful during the research process. After all, these projects are still being iterated, and previous tutorials may not be applicable. I hope this article and project can help those in need.