{"id":24061055,"url":"https://github.com/akikurisu/monoreference","last_synced_at":"2026-04-11T20:09:49.090Z","repository":{"id":205425286,"uuid":"714209848","full_name":"AkiKurisu/MonoReference","owner":"AkiKurisu","description":"MonoBehaviour Mod/Hot-Update solution with HybridCLR","archived":false,"fork":false,"pushed_at":"2023-11-04T10:44:04.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-26T14:29:33.965Z","etag":null,"topics":["hotupdate","hybridclr","mod","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AkiKurisu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-04T08:25:50.000Z","updated_at":"2023-12-21T06:32:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbb45ec3-5507-44a0-a7a5-9a00d9447acf","html_url":"https://github.com/AkiKurisu/MonoReference","commit_stats":null,"previous_names":["akikurisu/monoreference"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AkiKurisu/MonoReference","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiKurisu%2FMonoReference","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiKurisu%2FMonoReference/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiKurisu%2FMonoReference/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiKurisu%2FMonoReference/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AkiKurisu","download_url":"https://codeload.github.com/AkiKurisu/MonoReference/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AkiKurisu%2FMonoReference/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31693312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hotupdate","hybridclr","mod","unity"],"created_at":"2025-01-09T07:16:28.606Z","updated_at":"2026-04-11T20:09:49.076Z","avatar_url":"https://github.com/AkiKurisu.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MonoReference\n\n\n***Read this document in English: [English Document](./README_EN.md)***\n\n使用Reference方式序列化MonoBehaviour，资源加载时不再依赖Unity ResourceManager，而是由另一个Proxy脚本在加载后添加\n\n## 使用场景\n\n配合[HybridCLR](https://github.com/focus-creative-games/hybridclr)使用，为热更新资源添加新的MonoBehaviour，Assembly无需提前添加进``ScriptAssembly.json``，从而可以实现Mod功能\n\n可参考 https://hybridclr.doc.code-philosophy.com/docs/basic/monobehaviour ,作者的注释如下\n\n```C#\nprivate void AddHotFixAssembliesToScriptingAssembliesJson(string path)\n{\n    Debug.Log($\"[PatchScriptingAssemblyList]. path:{path}\");\n    /*\n        * ScriptingAssemblies.json 文件中记录了所有的dll名称，此列表在游戏启动时自动加载，\n        * 不在此列表中的dll在资源反序列化时无法被找到其类型\n        * 因此 OnFilterAssemblies 中移除的条目需要再加回来\n        */\n    string[] jsonFiles = Directory.GetFiles(path, SettingsUtil.ScriptingAssembliesJsonFile, SearchOption.AllDirectories);\n\n    if (jsonFiles.Length == 0)\n    {\n        //Debug.LogError($\"can not find file {SettingsUtil.ScriptingAssembliesJsonFile}\");\n        return;\n    }\n\n    foreach (string file in jsonFiles)\n    {\n        var patcher = new ScriptingAssembliesJsonPatcher();\n        patcher.Load(file);\n        patcher.AddScriptingAssemblies(SettingsUtil.HotUpdateAssemblyFilesIncludePreserved);\n        patcher.Save(file);\n    }\n}\n```\n如不放入json中则会在热更资源反序列时出现 ``MissingReference``\n\n## 普通C#类Reference？\n\n在HybridCLR中直接使用Activator.CreateInstance实例化即可","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakikurisu%2Fmonoreference","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakikurisu%2Fmonoreference","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakikurisu%2Fmonoreference/lists"}