Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(prefab): instances in the open scene take a changed prefab at once

yhh1124cac5e916
diff --git a/desktop b/desktop
index 5c55eed12..d7ee98ac6 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 5c55eed12d9b23b15ea4fd0cef5b8c81e0a4fa97
+Subproject commit d7ee98ac65a3bc308fb31559f12d3cd59419bbb0
diff --git a/docs/astro/src/content/docs/animation/rig-2d.mdx b/docs/astro/src/content/docs/animation/rig-2d.mdx
index 28c40c56d..1ef4c7fb7 100644
--- a/docs/astro/src/content/docs/animation/rig-2d.mdx
+++ b/docs/astro/src/content/docs/animation/rig-2d.mdx
@@ -26,7 +26,7 @@ Right-click an image in the Content Browser and choose **Create 2D Rig**. Then w
| **Weights** | **By Distance** binds what is nearest, then paint what that got wrong: pick a bone on the right and drag. `Shift` inverts, `Ctrl` smooths, `[` and `]` change the radius. **Whole Part to Selected Bone** is for a piece that does not bend. |
| **Deforms** | **New Shape**, then drag to push vertices: a breath, a smile, a bulge. |
-**Try Pose** turns bones to see how the weights hold up. It changes nothing in the rig, and **Bind Pose** puts it back. **Place in Scene** saves and instantiates the prefab. Saving again updates every instance in the open scene, keeping what a scene added to one; when the scene has unsaved changes, its instances update the next time it opens.
+**Try Pose** turns bones to see how the weights hold up. It changes nothing in the rig, and **Bind Pose** puts it back. **Place in Scene** saves and instantiates the prefab. Saving again updates every instance in the open scene at once, keeping what a scene added to one.
<Aside type="note">
This version has no adding or deleting single vertices, and a character draws from one image. Generating a part's mesh again clears that part's weights and deforms, and asks first.
diff --git a/docs/astro/src/content/docs/world/prefabs.mdx b/docs/astro/src/content/docs/world/prefabs.mdx
index dc84d8c29..a7bef77a8 100644
--- a/docs/astro/src/content/docs/world/prefabs.mdx
+++ b/docs/astro/src/content/docs/world/prefabs.mdx
@@ -64,6 +64,13 @@ The editor marks overrides so you always know what's local:
Reset a single field with its ↺ button and the value falls back to the prefab's.
+When the prefab changes, the open scene's instances take the change at once: saved from
+Prefab Mode, applied from another instance, rewritten on disk by a pull or another tool, or
+re-baked from the 2D rig it came from. Each instance keeps its overrides and anything the scene
+parented inside it, and every entity the prefab still has stays the same entity, so the
+selection and other entities' references to it hold. The scene is not marked as changed,
+because its file stores only the overrides.
+
### Apply · Revert · Unpack · Variant
Right-click an instance in the Outliner (or use the Inspector's prefab bar) for the identity
diff --git a/docs/astro/src/content/docs/zh-cn/animation/rig-2d.mdx b/docs/astro/src/content/docs/zh-cn/animation/rig-2d.mdx
index 08674f9ec..03000b312 100644
--- a/docs/astro/src/content/docs/zh-cn/animation/rig-2d.mdx
+++ b/docs/astro/src/content/docs/zh-cn/animation/rig-2d.mdx
@@ -26,7 +26,7 @@ import { Aside } from '@astrojs/starlight/components';
| **权重** | **按距离** 先绑定最近的骨骼,再刷它弄错的地方:在右侧选一根骨骼后拖动。`Shift` 反向,`Ctrl` 平滑,`[` 和 `]` 调半径。**整个部件跟选中骨骼** 用于不弯的部件。 |
| **变形** | **新建形状**,然后拖动把顶点推过去:呼吸、微笑、鼓起。 |
-**试摆** 可以转动骨骼,看权重是否合适。它不改骨骼文件,回到 **绑定姿势** 就复原。**放入场景** 会保存并实例化 prefab。再次保存时,打开的场景里所有实例都会更新,实例上后加的内容会保留;如果场景有未保存的修改,实例会在下次打开场景时更新。
+**试摆** 可以转动骨骼,看权重是否合适。它不改骨骼文件,回到 **绑定姿势** 就复原。**放入场景** 会保存并实例化 prefab。再次保存时,打开的场景里所有实例马上更新,实例上后加的内容会保留。
<Aside type="note">
这一版不支持单独增删顶点,一个角色只能用一张图。重新生成部件网格会清掉这个部件的权重和变形,操作前会提醒。
diff --git a/docs/astro/src/content/docs/zh-cn/world/prefabs.mdx b/docs/astro/src/content/docs/zh-cn/world/prefabs.mdx
index 5a3ecdcb9..9b35d4e07 100644
--- a/docs/astro/src/content/docs/zh-cn/world/prefabs.mdx
+++ b/docs/astro/src/content/docs/zh-cn/world/prefabs.mdx
@@ -52,6 +52,10 @@ Prefab Mode 暂不支持:就地编辑**嵌套**预制体,或基不是扁平的
用字段的 ↺ 按钮重置单个字段,值会回落到预制体的值。
+预制体一变,打开的场景里的实例马上跟着变:在 Prefab Mode 里保存、从另一个实例 Apply、被拉取代码或别的工具改了文件、
+或者它来自的 2D 骨骼重新保存,都一样。每个实例保留自己的覆盖,以及场景挂在它里面的东西;预制体里还在的实体仍是同一个实体,
+所以选中状态和其他实体对它的引用都不会断。场景不会被标成已修改,因为场景文件里只存覆盖。
+
### Apply · Revert · Unpack · Variant
在 Outliner 里右键一个实例(或用检视器的 prefab 条)可执行这些身份操作: