Resources are split into three AssetBundles: AOT, hot-update assembly, and game scene. Original resources contain all three bundles. Update resources contain only the assembly and scene bundles. AOT is fixed in the installed application and is never updated from the server.
Install AppRuntimes through Package Manager using its Git URL. Once the Editor finishes importing, an independent Editor assembly checks for com.code-philosophy.hybridclr. If missing, it uses Unity Package Manager to add https://gitee.com/focus-creative-games/hybridclr_unity.git#v9.0.3 to the project's dependencies. It preserves an existing HybridCLR package, including Git, registry, embedded, and local installations.
Unity does not support Git dependencies inside a package's package.json; Git URLs must be project dependencies. The installer therefore uses Client.Add instead of declaring an invalid package dependency or editing another project's manifest directly. See Unity Git dependencies.
Installation runs asynchronously after compilation and import finish. A failed attempt does not repeat on every domain reload. Open AppSettings and select Retry HybridCLR Installation, or add the URL manually through Package Manager. The official GitHub alternative is https://github.com/focus-creative-games/hybridclr_unity.git#v9.0.3. Projects with existing script compilation errors may need this manual installation before Editor initialization can run. Wait for installation and compilation before clicking Save.
Adding the UPM package and running HybridCLR/Installer are separate steps. 一键打包资源 still performs Installer setup and Generate/All when needed; the package import step does not build a Player or modify IL2CPP. See HybridCLR installation.
Select AppSettings/Install Unity MCP to install com.coplaydev.unity-mcp from https://github.com/CoplayDev/unity-mcp.git?path=/MCPForUnity#main when absent. Installation starts only from this menu, which also retries failed installations; startup and status checks do not schedule it. Its installer shares the HybridCLR request queue. Existing installations are not upgraded. Editor startup checks for Assets/Launch after compilation and import finish, then copies the package's Templates~/Launch if that folder is absent. It preserves scene/script GUID references and leaves existing project Launch content intact. AppSettings/Load Launch Templates also remains available for manual loading. Open Settings appears first in the AppSettings menu, followed by a separator, Load Launch Templates, and Install Unity MCP.
Save automatically adds missing AppRuntimes.Base and Unity.Advertisement.IosSupport references to the selected runtime asmdef, preserving other settings and supporting both name and GUID references. The build button and menu stay disabled while required references or saved assembly/scene settings are missing. The window also disables building for unsaved assembly/scene selections; Save refreshes its state. Compilation, Play Mode, uploads and ongoing builds temporarily disable building.
In AppSettings/Open Settings, select the hot-update asmdef, enter the Game Scene Name and DownloadUrl, then click Save. The current configuration is HexaCrazy.Runtime / HexaCrazy. The scene name excludes .unity and must be unique under Assets. Selecting an assembly synchronizes the HybridCLR hot-update settings.
DownloadUrl accepts a resource directory (automatically appending manifest.json) or a complete manifest URL. When accessing a local IIS server from a phone, use the computer's LAN IP address or domain name instead of localhost. HTTP debugging requires HTTP to be enabled in Player Settings; use HTTPS for releases.
The game scene is provided by its bundle and excluded from the Player scene list. Resource builds first normalize the global scene list and any active Build Profile override to a single enabled Launch scene. Other entries are removed from the list; scene assets are retained. Keep the game scene's own MonoBehaviours. Launch loads the configured scene without a separate game-entry call.
LaunchApp.RunAsync(Action onUpdated = null) updates resources, then invokes the supplied callback. Without a callback it awaits OpenSceneAsync() directly. To defer scene entry, supply a callback to show your ready/start UI, then call OpenSceneAsync() when ready. The callback runs after IsRunning is cleared and may also call OpenSceneAsync() immediately. Prepared resources are reused, and all scene loading, activation, input transfer, Editor initialization and Launch unloading are handled by OpenSceneAsync(). IsResourcesReady indicates a successful update; IsCompleted becomes true only after scene entry and Launch scene unloading finish. Update retries preserve the callback. Failed or canceled updates do not invoke it. Callback exceptions propagate to the caller.
AppSettings enables 使用本地资源测试, 恢复正式资源, and 上传资源 when Build/HotUpdate contains a complete AllRes_<timestamp> directory matching the saved assembly, game scene, and active build target. It selects the newest complete matching directory. Both manifests and their referenced files must exist. Build, upload, compilation, and Play Mode temporarily disable resource switching.
使用本地资源测试 verifies and stages manifest_hot.json, its assembly and scene bundles, and the fixed AOT bundle. It replaces all StreamingAssets contents and names the selected manifest manifest.json. It saves local testing mode in AppSettings. Launch extracts and verifies those resources using a separate HotUpdate/LocalTest cache and makes no remote manifest or resource requests. DownloadUrl is preserved and may be empty in this mode. This also works in iOS and Android Players; Editor execution continues to use its local script assemblies as before.
恢复正式资源 replaces StreamingAssets with manifest.json and only its referenced original resources from the same latest archive. It disables local testing mode, so Launch resumes remote updates. A successful original resource publication during 一键打包资源 also restores normal mode. Source validation and staging finish before replacing StreamingAssets; missing or corrupt inputs leave the previous installation intact.
| Bundle | Input | Update policy |
|---|---|---|
aot.bundle |
Four .dll.bytes files in the project's Assets/AotDlls |
Shipped only with the original application |
hotupdate.<lowercase-assembly>.bundle |
<assembly>.dll.bytes compiled for the current platform |
Updated by SHA-256 comparison |
scene.<lowercase-scene>.bundle |
The scene configured in AppSettings and its dependencies collected by Unity | Updated by SHA-256 comparison |
Assets/AotDlls contains exactly:
Assets/AotDlls/
mscorlib.dll.bytes
Newtonsoft.Json.dll.bytes
System.Core.dll.bytes
UniTask.dll.bytes
Original builds generate four stripped metadata DLLs from the current platform's Generate/All stripped AOT archive, copy them to the project's Assets/AotDlls, and pack those four files into the AOT bundle. Old Windows AOT data is not used for Android/iOS release resources. Update builds neither rebuild the AOT bundle nor modify Assets/AotDlls.
DLLs remain .dll.bytes TextAssets inside bundles and are loaded by fixed file names. Bundles use LZ4 and retain TypeTree data. Builds do not depend on AssetBundle labels on other project assets. Unity automatically collects scene dependencies, and the build rejects additional bundle dependencies. At runtime, AssetBundle.GetAllScenePaths provides the actual scene path.
Before serializing bundles, both original and update builds run the official TMP build preprocessor to clear Dynamic / Dynamic OS font caches with Clear Dynamic Data On Build enabled, then save those fonts and atlases. Characters added while previewing or running UI in the Editor therefore do not change scene bundles unnecessarily. Static fonts and fonts without this setting are preserved, as are OpenType feature data and runtime dynamic glyph generation. Changes to scenes, actual dependencies, or serialized structures still produce new bundle hashes.
The menu contains only 资源构建/一键打包资源, which performs these stages:
Build/HotUpdate/AllRes_yyyyMMdd_HHmmss_fff. Replace StreamingAssets with only manifest.json and its referenced original resources. Compilation or resource preparation failures preserve the previous StreamingAssets and current baseline pointer. Other files in the assembly directory are preserved.Separate original/update builds, source synchronization, and DLL compilation remain available as Editor APIs, without separate menu entries.
Generate/All performs the build steps required to obtain stripped AOT assemblies. 一键打包资源 does not additionally create a complete APK/Xcode application package; build that afterward through Unity. The Player requires .NET Framework rather than netstandard; see the official migration guide.
Resource build commands disable EditorUserBuildSettings.buildScriptsOnly. Use Build or Clean build for the application package. After changing scenes or resources, do not force reuse of old Player data through Force skip data build, which can cause Cached scene list differs from what is being built or omit the latest StreamingAssets.
During Android AOT stripping and bundle builds, External Dependency Manager's automatic AAR resolution is temporarily disabled and then restored. Normal APK builds retain their existing dependency resolution settings. Intermediate bundles are stored in Build/HotUpdate/BundleCache/<platform>; only bundles declared in the manifest are published to original or update directories.
Original baselines are archived in Build/HotUpdate/Baselines/<platform>/<build-id>, including the original stripped AOT assemblies, four stripped metadata DLLs, the fixed AOT bundle, and hashes. Update builds verify Unity/HybridCLR, platform, API compatibility, Development Build, host code, and assembly settings. New host dependencies or incompatible members require rebuilding original resources and the application package.
For iOS, the host explicitly references ATTrackingStatusBinding, and the linker preserves Unity.Advertisement.IosSupport. The Editor-only Sources assembly cannot reveal calls compiled only for the iOS Player. These preservation changes invalidate the previous Generate/All record and require a fresh baseline. This assembly stays in the AOT host; the four supplemental metadata DLLs in Assets/AotDlls remain unchanged.
Original StreamingAssets:
manifest.json
aot.bundle
files/<assembly-bundle-SHA256>.bundle
files/<scene-bundle-SHA256>.bundle
A server update directory contains only manifest.json and two files/*.bundle files. Upload files before replacing manifest.json. IIS must allow .json and .bundle static files.
Both original and update manifests use schemaVersion 4 with the same field structure: platform, build ID, assembly, and scene name/path. resources contains each version's assembly and scene bundles. aotBundles identifies the same fixed AOT bundle, and aotMetadata records the same four DLL sizes and hashes. Update manifests inherit AOT information from the original baseline without rebuilding or remotely downloading the AOT bundle. Legacy schemaVersion 3 raw DLL resources cannot be mixed with these bundles; rebuild original resources, the application package, and updates.
After 一键打包资源, Build/HotUpdate/AllRes_<timestamp> contains every bundle referenced by both manifests. StreamingAssets retains the original layout shown above.
manifest.json # Original resource manifest
manifest_hot.json # Update resource manifest
aot.bundle # Fixed AOT shared by both manifests
files/*.bundle # Original and update bundles, deduplicated by content hash
Launch still initializes its original cache from the installed manifest.json. When hosting the AllRes output directory directly, set DownloadUrl to the complete https://server/resource-directory/manifest_hot.json URL to retrieve updates. Separate update builds through the Editor API output manifest.json, which remains the default for directory URLs. Builds do not change AppSettings URLs automatically. DLLs inside bundles retain .dll.bytes, while external bundles use .bundle. Migrating from .bundle.bytes requires rebuilding resources and the application package and updating the server files together.
Application.temporaryCachePath/HotUpdate/<build-id-hash>. If the cache is missing, also extract the original assembly bundle, scene bundle, and manifest. Verify the size and SHA-256 of every bundle.resources, reuse a cached file with the expected size and SHA-256, restore matching content from StreamingAssets, or download it from the server. The installed package supplies the AOT metadata used at launch.With DownloadUrl configured, the Editor follows the same download, bundle-reading, and scene-bundle loading flow. It skips native AOT APIs, duplicate Assembly.Load calls, and initialization in the local hot-update assembly. Without a URL, it previews the local scene. After the game scene is loaded and active and input is ready, Launch waits until the next frame and invokes the tagged initializer in AppRuntimes.Sources.Editor, then unloads Launch. This Editor-only call is excluded from Player builds and works after generated HotPatch sources have been deleted. Exiting Play Mode releases the previously retained scene bundle. Loaded DLLs are not replaced while running; restart to verify a new version.
Build resources and application packages separately for Android and iOS; Windows AOT data or bundles cannot be reused. Android APK jar:file://...!/assets paths and read-only iOS StreamingAssets are extracted through UnityWebRequest, then bundles are read from the writable cache. iOS application packages still require compilation and signing with macOS/Xcode.
Logs use the [HotPatch] prefix and record manifests, cache operations, differences, download progress (at most once per second), verification, and bundle/AOT/DLL/scene loading results. URL query parameters and account credentials are omitted.
adb logcat -v time Unity:I '*:S' | Select-String '\[HotPatch\]'
For the first update, check version_compare, download_complete, aot_load_result, assembly_load_complete, scene_bundle_ready, scene_load_complete, and scene_input_ready. Input readiness logs identify the EventSystem source, owning scene, and enabled input modules. With no update, expect changedFiles=0 and manifest_unchanged. Reading bundles in tests is not equivalent to execution on an Android/iOS device.
Launch startup failures use a native Android/iOS alert with the message There is a problem with the network. Please try again later. and one retry button. The Editor uses a system dialog with the same text. Launch no longer creates an on-screen retry button or exposes exception details in its status text. Confirmation retries on Unity's main thread after the previous attempt finishes. Canceled startup does not display an error. Detailed failures and retry_dialog_open / retry_dialog_confirmed remain in the logs. The loader still rejects retries after an irreversible assembly/initialization failure; those failures require restarting the application.
The retry-only iOS dialog adds an AOT native entry point. Rebuild resources and the application package before device testing this change.
Launch belongs to the host assembly in the installed application. Changes to scene transitions or input transfer require rebuilding original resources (or using 一键打包资源) and the application package; updating only the hot DLL is insufficient.
Runtime/Sources retains .cs files in an Editor-only assembly. Each file requires the following outer wrapper. Synchronizing into the target assembly's HotPatch directory removes only this wrapper and preserves inner platform directives.
#if UNITY_EDITOR
public class ExampleRuntime { }
#endif
Generated file ownership and hashes are recorded in ProjectSettings/HotPatchSources.json. Normal synchronization and update builds write only changed templates, remove generated files whose templates were deleted, and reject overwriting manually edited generated files. After checking Generate/All, original builds delete the entire current target HotPatch directory, including manual files, subdirectories, and .meta files, without recreating it during that build. The next update build copies Sources again. Other files in the assembly directory are preserved.
In the Player, the loader scans only the selected DLL for [HotPatch.HotPatchInitializer] methods and invokes them in Order, type-name, and method-name order. In the Editor, Launch scans only AppRuntimes.Sources.Editor after loading the game scene. Entries must be parameterless, non-generic, non-async static void methods. AppRuntimes.Initialization() is marked and retains its background CheckVersion behavior; the game does not need to initialize the SDK again. The package Sources assembly and Launch's Editor initialization call are not compiled into the installed Player; the copied Sources still initialize through the downloaded hot-update DLL.
[HotPatch.HotPatchInitializer]
public static void Initialization() { }
AppRuntimes.Base/NativeApi.cs contains only AppInfo, TimeZone, and Dialog. Facebook dynamic configuration uses FacebookNativeBridge in the same AOT assembly; IAP and UniWebView use their own native declarations. P/Invoke is not allowed in hot-update DLLs. AOT native interface changes must ship in a new application package.