docs(scripting): add baseline api reference and guide
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# MonoScriptRuntime::SyncManagedFieldsToStorage
|
||||
|
||||
**命名空间**: `XCEngine::Scripting`
|
||||
|
||||
**类型**: `method`
|
||||
|
||||
**头文件**: `XCEngine/Scripting/Mono/MonoScriptRuntime.h`
|
||||
|
||||
## 签名
|
||||
|
||||
```cpp
|
||||
void SyncManagedFieldsToStorage(
|
||||
const ScriptRuntimeContext& context) override;
|
||||
```
|
||||
|
||||
## 当前实现行为
|
||||
|
||||
- 要求 `context.component`、实例缓存和类元数据都存在。
|
||||
- 只遍历当前 `ScriptFieldStorage` 里已经存在的字段名。
|
||||
- 只有字段名存在于类元数据中且类型匹配,才会从托管对象读回并写回本地缓存。
|
||||
|
||||
## 重要边界
|
||||
|
||||
这意味着:
|
||||
|
||||
- 托管运行时中新出现但本地没存过的字段,不会自动持久化。
|
||||
- 本地字段类型如果和类定义不匹配,也不会被强行覆盖。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [CreateScriptInstance](CreateScriptInstance.md)
|
||||
- [ScriptFieldStorage](../../ScriptFieldStorage/ScriptFieldStorage.md)
|
||||
Reference in New Issue
Block a user