Skip to content

Commit

Permalink
更新dots相关文档
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Mar 9, 2024
1 parent 5acc0f1 commit c4a476a
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 17 deletions.
8 changes: 8 additions & 0 deletions docs/basic/dots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# DOTS支持

DOTS的并不支持动态注册Component、System、Aspect等核心类型,导致热更新中的DOTS相关类型无法被DOTS运行时识别,无法正常运行。

商业化版本对DOTS做了部分修改,并且相应调整了运行时代码,最终实现了支持DOTS绝大多数特性。尤其是旗舰版本,标记`[BurstCompile]`的函数如果未修改,
可以直接调用burst函数实现,可以极大提升性能。

具体请参见[商业化版本的DOTS 支持](../business/dots)文档。
2 changes: 1 addition & 1 deletion docs/basic/notsupportedfeatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
:::

- 暂时不支持在热更新脚本中定义extern函数,但可以调用AOT中extern函数。
- 支持2022的dots技术,需要小幅修改dots代码以支持动态注册component和system类型(**需要购买商业化版本获得实现细节**),而且无法利用burst加速。如果burst部分在AOT,则仍然原生方式执行;如果burst部分在热更部分,则虽然是Jobs并发执行,但以解释方式执行。
- 社区版本不支持dots,商业化版本支持绝大多数dots特性,详见[dots兼容性](./dots)
- 不支持`System.Runtime.InteropServices.Marshal``Marshal.StructureToPtr`之类序列化结构的函数,但普通Marshal函数如`Marshal.PtrToStringAnsi`都是能正常工作的。
- 不支持[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.xxx)]。纯粹是时机问题,Unity收集这些函数的时机很早,此时热更新dll还没加载。一个推荐的办法是你使用反射收集这些函数,在合适的时机主动调用它们。
- 不支持对解释代码部分进行C#级别调试,因为没暂时没时间写调试器
Expand Down
38 changes: 38 additions & 0 deletions docs/business/dots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# DOTS支持


商业化版本修改了DOTS运行时代码及hybridclr运行时代码,支持绝大多数DOTS特性。


## 特性的支持状况

:::tip

注意,我们不单独罗列Shared Component之类的特性,它们统一归类到Component特性。

:::

|特性|社区版本|专业版|旗舰版|热重载版|
|-|-|-|-|-|
|Jobs|||||
|Managed Component|||||
|Unmanaged Component|||||
|Managed System|||||
|Unmanaged System|||||
|Aspect|||||
|IJobEntity|||||
|BurstCompile|||||
|SubScene|||||

## 注意事项

1. 专业版和热重载版热更新模块的DOTS代码以解释方式执行
2. 热重载版本无法卸载包含DOTS代码的程序集
3. 旗舰版本对标记了`[BurstCompile]`函数,未改变前执行原始burst代码,改变后会以解释方式执行。**改变的burst函数需要删除[BurstCompile]特性,否则运行时将出错**
4. 由于Unity的dots资源的序列化机制的并不支持新增热更新类型,包含热更新组件的资源的SubScene无法正确还原Component

## 支持的Unity及DOTS版本

由于DOTS代码处于不断变动中,目前仅支持 Unity 2022.3.0+ 及 com.unity.entities 1.0.16+版本。我们正尝试支持更多的Unity及DOTS版本。

由于维护多个DOTS版本成本较高,有特殊版本需求的开发者,请联系我们单独付费订制。
8 changes: 0 additions & 8 deletions docs/business/supportdots.md

This file was deleted.

8 changes: 8 additions & 0 deletions i18n/en/docusaurus-plugin-content-docs/current/basic/dots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# DOTS support

DOTS does not support dynamic registration of core types such as Component, System, and Aspect. As a result, DOTS-related types in hot updates cannot be recognized by the DOTS runtime and cannot operate normally.

The commercial version made some modifications to DOTS and adjusted the runtime code accordingly, ultimately supporting most of the features of DOTS. Especially for the flagship version, if the function marked `[BurstCompile]` is not modified,
It can be implemented by directly calling the burst function, which can greatly improve performance.

For details, please refer to the [Commercial version of DOTS support] (../business/dots) document.
38 changes: 38 additions & 0 deletions i18n/en/docusaurus-plugin-content-docs/current/business/dots.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# DOTS Support


The commercial version has modified the DOTS runtime code and hybridclr runtime code to support most DOTS features.


## Feature support status

:::tip

Note that we do not list features such as Shared Component separately, they are collectively classified into Component features.

:::

|Features|Community Edition|Professional Edition|Ultimate Edition|Hot Reload Edition|
|-|-|-|-|-|
|Jobs|||||
|Managed Component|||||
|Unmanaged Component|||||
|Managed System|||||
|Unmanaged System|||||
|Aspect|||||
|IJobEntity|||||
|BurstCompile|||||
|SubScene|||||

## Precautions

1. The DOTS code of the hot update module of the professional version and hot reload version is executed in interpreted mode
2. The hot reload version cannot uninstall an assembly containing DOTS code.
3. The flagship version has marked the `[BurstCompile]` function. The original burst code will be executed before it is changed. After the change, it will be executed in interpreted mode. **The changed burst function needs to delete the [BurstCompile] attribute, otherwise an error will occur during runtime**
4. Since the serialization mechanism of Unity’s dots resources does not support the new hot update type, the SubScene of the resource containing the hot update component cannot correctly restore the Component.

## Supported Unity and DOTS versions

Since the DOTS code is constantly changing, currently only Unity 2022.3.0+ and com.unity.entities 1.0.16+ versions are supported. We are trying to support more Unity and DOTS versions.

Due to the high cost of maintaining multiple DOTS versions, developers who have special version requirements should contact us to pay for a separate order.

This file was deleted.

3 changes: 2 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const sidebars = {
'basic/monobehaviour',
'basic/aotgeneric',
'basic/methodbridge',
'basic/dots',
'basic/memory',
'basic/performance',
'basic/notsupportedfeatures',
Expand All @@ -83,7 +84,7 @@ const sidebars = {
'business/intro',
'business/differentialhybridexecution',
'business/fullgenericsharing',
'business/supportdots',
'business/dots',
'business/metadataoptimization',
'business/basiccodeoptimization',
'business/basicencryption',
Expand Down

0 comments on commit c4a476a

Please sign in to comment.