Files
XCEngine/docs/plan/Unity式Tick系统与PlayMode运行时方案-阶段进展.md

63 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Unity式 Tick 系统与 Play Mode 运行时方案阶段进展
日期2026-04-02
## 已完成
### 阶段 A
- 已接入 `RuntimeLoop`,统一承载 `FixedUpdate / Update / LateUpdate`
- 已接入 `PlaySessionController`
- 已实现 `Play / Stop`
- Play 时运行 runtime scene clone
- Stop 时恢复 editor scene snapshot
- `Run` 菜单与 `F5` 已可切换 `Play / Stop`
### 阶段 B 当前收口
- 明确区分“文档级编辑”和“运行态场景对象编辑”
- `New/Open/Save Scene``New/Open/Save Project` 仍只允许在 `Edit` 下执行
- `Play / Paused` 下允许对 runtime scene 进行对象级编辑与 `Undo / Redo`
- runtime scene 的对象改动默认不再污染场景文档 dirty 状态
### 阶段 C 当前收口
- 已补全 `Pause / Resume / Step` 的完整请求与状态切换
- `Run` 菜单现在区分 `Play/Stop``Pause/Resume``Step`
- `Error Pause` 已接入正式 Pause 请求通道
- `Paused` 下维持 runtime world不回退到 editor scene
- `Step` 现在只在 `Paused` 下有效,并保持 `Paused` 状态不变
### 阶段 D 当前收口
- 已在软件顶部增加独立运行栏
- 运行栏已接入 `Play / Pause / Step` 三个图标按钮
- 顶部按钮直接复用现有 PlayMode 请求通道,不额外分叉状态机
- `Play` 按钮在运行中会保持高亮,再次点击即 `Stop`
- `Pause``Play / Paused` 下可用,并沿用现有 `F6`
- `Step` 仍只在 `Paused` 下可用
- 顶部栏已改为参与 dockspace 布局,不再覆盖 Scene / Hierarchy / Inspector 面板标题区
## 本轮验证
- 已重新执行 `cmake -S . -B build`
- 已通过 `cmake --build build --config Debug --target scene_tests`
- 已通过 `cmake --build build --config Debug --target editor_tests -- /m:1 /v:minimal`
- 已通过 `cmake --build build --config Debug --target XCEditor -- /m:1 /v:minimal`
- 已通过聚焦测试:
`ctest --test-dir build -C Debug --output-on-failure -j1 -R "RuntimeLoopTest|PlaySessionControllerTest|EditorActionRoutingTest.*PlayMode|EditorActionRoutingTest.*MainMenuRouterRequestsPlayPauseResumeAndStepEvents"`
## 当前语义
- `editor tick` 负责托管运行时会话
- `engine tick` 负责推进 runtime world
- Play 时 `Hierarchy / Inspector / SceneView / GameView` 面对的是同一份 runtime world
- Play 中对对象的改动默认是临时运行态改动Stop 后回滚
- Play 中禁止的是文档切换与文档保存,不是禁止观察或编辑 runtime clone
## 下一阶段建议
- 明确 `Paused` 下的 `Undo / Redo / Gizmo / Inspector` 更细粒度交互边界
- 将 GameView 输入正式接入 runtime input 通道
- 继续补 `Simulate` 与更完整的 Time 语义