Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Oct 4, 2024
1 parent 90483e8 commit 7b7b045
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/business/reload/hotreloadassembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

- 要求业务代码不会再使用被卸载的Assembly中的对象或者函数,并且退出所有在执行的旧逻辑
- 不能直接卸载被依赖的Assembly,必须按照逆依赖顺序先卸载依赖者,再卸载被依赖者。例如A.dll依赖B.dll,则需要先卸载A.dll,再卸载B.dll
- MonoBehaviour和ScriptableObject相关
- MonoBehaviour、ScriptableObject、以及标记了`[Serializable]`的类型
- 要求重载的MonoBehaviour中的事件或消息函数如Awake、OnEable之类不发生增删(但函数体可以变化)
- 要求重载后在旧Assembly中存在同名脚本类的序列化字段名不发生变化(类型可以变)
- 如果字段类型为可卸载程序集中的自定义类型A(class或struct或enum),必须给它加上`[Serializable]`特性
- 不支持字段类型为`List<A>`其中A为可卸载的程序集中的类型,请替换为`A[]`
- 不能继承泛型类型,例如`class MyScript : CommonScript<int>`
- 不能是泛型,也不能继承泛型类型,例如`class MyScript<T>``class MyScript : CommonScript<int>`
- 一些会缓存反射信息的库(这种行为在序列化相关的库中最为普遍,如LitJson),在热重载后需要清理掉缓存的反射信息
- 不支持析构函数,~XXX()。也不允许实例化泛型参数带本程序集类型的带析构函数的泛型类
- 与dots不兼容。由于dots大量缓存的类型信息,实现复杂,很难单独清理掉缓存信息。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ Hot reload technology is used to completely uninstall or reload an assembly, whi

- Require that business code will no longer use objects or functions in the uninstalled assembly, and exit all old logic in execution
- Cannot directly uninstall the dependent assembly, must first uninstall the dependent in reverse dependency order, and then uninstall the dependent. For example, if A.dll depends on B.dll, you need to uninstall A.dll first, then uninstall B.dll
- MonoBehaviour is related to ScriptableObject
- It is required that events or message functions in the overloaded MonoBehaviour, such as Awake and OnEable, do not be added or deleted (but the function body can change)
- It is required that the serialized field name of the script class with the same name in the old assembly does not change after overloading (the type can change)
- If the field type is a custom type A (class or struct or enum) in the uninstallable assembly, it must be given the `[Serializable]` attribute
- The field type `List<A>` is not supported, where A is a type in the uninstallable assembly, please replace it with `A[]`
- Generic types cannot be inherited, such as `class MyScript : CommonScript<int>`
- MonoBehaviour,ScriptableObject and types are marked `[Serializable]`
- It is required that events or message functions in the overloaded MonoBehaviour, such as Awake and OnEable, do not be added or deleted (but the function body can change)
- It is required that the serialized field name of the script class with the same name in the old assembly does not change after overloading (the type can change)
- If the field type is a custom type A (class or struct or enum) in the uninstallable assembly, it must be given the `[Serializable]` attribute
- The field type `List<A>` is not supported, where A is a type in the uninstallable assembly, please replace it with `A[]`
- Cann't be generic types, .eg `class MyScript<T> : MonoBehaviour`
- Generic types cannot be inherited, such as `class MyScript : CommonScript<int>`
- Some libraries that cache reflection information (this behavior is most common in serialization-related libraries, such as LitJson), need to clean up the cached reflection information after hot reloading
- Destructors, ~XXX(), are not supported. It is also not allowed to instantiate generic classes with destructors whose generic parameters are of this assembly type
- Incompatible with dots. Since dots caches a large amount of type information and the implementation is complex, it is difficult to clean up the cache information separately.
Expand Down

0 comments on commit 7b7b045

Please sign in to comment.