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.

docs: how many sorting layers there are, and that naming is optional

yhh659793f5c1ea
diff --git a/docs/astro/src/content/docs/guides/editor.mdx b/docs/astro/src/content/docs/guides/editor.mdx
index fffa2b3a4..de49e7819 100644
--- a/docs/astro/src/content/docs/guides/editor.mdx
+++ b/docs/astro/src/content/docs/guides/editor.mdx
@@ -369,7 +369,9 @@ Open settings with **Ctrl / ⌘ + ,** or the Activity Bar's gear. Settings are g
- **Physics** — enable, gravity, sixteen collision-layer names and a 16×16 collision
matrix, plus solver tuning (fixed timestep, sub-steps, contact Hz/damping/push
speed, sleeping, continuous collision). See [Physics](/docs/guides/physics/).
- - **Rendering** — named sorting layers that populate the inspector's layer dropdown.
+ - **Rendering** — up to thirty-two named sorting layers that populate the inspector's
+ layer dropdown, and which of them y-sort. Naming is optional: with no names, a
+ render `layer` stays a free number.
- **Packaging** — per-target metadata: WeChat AppID, Desktop app id / product name.
### Editor language
diff --git a/docs/astro/src/content/docs/guides/sprites.mdx b/docs/astro/src/content/docs/guides/sprites.mdx
index 892391f17..6600bc477 100644
--- a/docs/astro/src/content/docs/guides/sprites.mdx
+++ b/docs/astro/src/content/docs/guides/sprites.mdx
@@ -98,6 +98,10 @@ etc. instead of a raw number. Lower layers draw first (behind).
![Left: three sorting layers stacked so a higher layer draws in front. Right: on a Y-sorted layer a sprite lower on screen draws in front of one higher up.](../../../assets/guides/sprite-sort.svg)
+Naming is a readability feature, not a limit: name up to thirty-two slots (a slot's
+index *is* its z-order), or name none and the inspector leaves `layer` a plain number
+field. The renderer itself sorts on any integer either way.
+
```typescript
sprite.layer = 0; // e.g. "Background"
sprite.layer = 2; // e.g. "Foreground" — drawn on top
diff --git a/docs/astro/src/content/docs/zh-cn/guides/editor.mdx b/docs/astro/src/content/docs/zh-cn/guides/editor.mdx
index 9ade52e80..364988073 100644
--- a/docs/astro/src/content/docs/zh-cn/guides/editor.mdx
+++ b/docs/astro/src/content/docs/zh-cn/guides/editor.mdx
@@ -296,7 +296,8 @@ Details 同时是**资产检视器**:在内容浏览器里选中一个资产,即
和所有导出里一致生效。见 [UI 控件——主题](/docs/zh-cn/guides/ui-components/#主题)。
- **物理** — 启用、重力、十六个碰撞层名字和一个 16×16 碰撞矩阵,以及解算器调参(固定时间步、
子步、接触 Hz/阻尼/推出速度、允许睡眠、连续碰撞)。见 [物理](/docs/zh-cn/guides/physics/)。
- - **渲染** — 命名排序层,填充检视器里的层下拉。
+ - **渲染** — 最多三十二个命名排序层,填充检视器里的层下拉,以及其中哪些参与 Y 轴排序。
+ 命名是可选的:一个名字都不填时,渲染组件的 `layer` 仍是自由数字。
- **打包** — 每目标元数据:微信 AppID、桌面应用 id / 产品名。
### 编辑器语言
diff --git a/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx b/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx
index 106f4d88a..aea293520 100644
--- a/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx
+++ b/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx
@@ -88,6 +88,9 @@ sprite.color = { r: 1, g: 1, b: 1, a: 0.5 }; // 50% 透明
![左:三个排序层堆叠,更高的层画在前面。右:在 Y-排序层上,屏幕上更靠下的精灵画在更靠上的前面。](../../../../assets/guides/sprite-sort.svg)
+命名是为了可读性,不是层数上限:你可以命名最多三十二个槽位(槽位的下标**就是**它的 z 序),
+也可以一个都不命名——那样检视器把 `layer` 留成普通数字输入框。两种情况下渲染器都按任意整数排序。
+
```typescript
sprite.layer = 0; // 例如 "Background"
sprite.layer = 2; // 例如 "Foreground" —— 画在上面