图形组件
下面每个字段都由引擎自身的组件注册表推导而来——就是编辑器 Details 面板读的那一份——
所以这里的类型和默认值就是你添加组件时真正拿到的值,且不可能与代码脱节。讲怎么用的正文在
每条目所链接的指南里。字段说明取自 C++ ES_PROPERTY 处的原文,因此为英文。
BitmapText
Text drawn in world space from a bitmap font, sorted alongside sprites (UI text is `Text`).
Explained in graphics/sprites.
| Field | Type | Default | Notes |
|---|---|---|---|
text | string | empty | |
color | Color | #ffffff | |
fontSize | number | 1 | Range ≥ 1. |
align | enum | Left | One of Left, Center, Right. |
spacing | number | 0 | |
parallax | Vec2 | (1, 1) | Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera). |
layer | number | 0 | Range step 1. |
font | Asset<font> | none | |
enabled | boolean | true |
CacheAsBitmap
Renders an expensive subtree once into a texture and reuses it until marked dirty.
Explained in graphics/sprites.
| Field | Type | Default | Notes |
|---|---|---|---|
enabled | boolean | true | |
dirty | boolean | true | |
width | number | 256 | |
height | number | 256 |
Camera
A view onto the world — projection, zoom, viewport rect, clear flags and render priority.
Explained in graphics/camera.
| Field | Type | Default | Notes |
|---|---|---|---|
projectionType | enum | Orthographic | Orthographic (2D) or Perspective projection. One of Perspective, Orthographic. |
fov | number | 60 | Range 1–179. |
orthoSize | number | 540 | Half the visible height in world units (Orthographic). Range ≥ 0. |
nearPlane | number | 0.1 | Range ≥ 0. |
farPlane | number | 1000 | Range ≥ 0. |
aspectRatio | number | 1.77 | |
isActive | boolean | true | |
priority | number | 0 | Range step 1. |
viewport | Vec4 | (0, 0, 1, 1) | |
clearFlags | number | 3 | Which buffers to clear before rendering this camera. |
pixelPerfect | boolean | false | Snap the camera to the pixel grid for crisp pixel-art (Orthographic). |
cullingMask | number | 4294967295 | Which sorting layers this camera renders. |
showFrustum | boolean | false | Draw this camera's whole view volume in the editor, not just what it frames on the content plane. |
CameraBounds
The world rectangle a camera may not look outside of, so the level edge stays at the screen edge.
Explained in graphics/camera.
| Field | Type | Default | Notes |
|---|---|---|---|
minX | number | 0 | |
minY | number | 0 | |
maxX | number | 0 | |
maxY | number | 0 |
Canvas
The design resolution and scale mode a scene is authored against — one per scene root.
Explained in core-concepts/screen.
| Field | Type | Default | Notes |
|---|---|---|---|
designResolution | Vec2 | (1920, 1080) | |
pixelsPerUnit | number | 100 | World pixels per physics meter (Box2D + tile collider scale). Range ≥ 1. |
scaleMode | enum | FixedHeight | How the canvas adapts the design resolution to the screen. One of FixedWidth, FixedHeight, Expand, Shrink, Match. |
matchWidthOrHeight | number | 0.5 | 0 matches width, 1 matches height (Match mode only). Range 0–1. |
backgroundColor | Color | #000000 | |
layer | enum (sortingLayers) | 0 | Sorting layer this UI belongs to — cameras cull by it. Range step 1. |
FollowTarget
Makes a camera chase an entity, with an offset, a dead zone and eased catch-up.
Explained in graphics/camera.
| Field | Type | Default | Notes |
|---|---|---|---|
target | number | -1 | |
offsetX | number | 0 | |
offsetY | number | 0 | |
deadzone | number | 0 | |
damping | number | 0.25 |
Light2D
A 2D light — point, directional, spot or ambient — that lit renderers and Lit2D materials receive.
Explained in graphics/lighting.
| Field | Type | Default | Notes |
|---|---|---|---|
type | enum | Point | Point, Directional, Ambient, or Spot. One of Point, Directional, Ambient, Spot. |
color | Color | #ffffff | |
intensity | number | 1 | Brightness multiplier of the light. Range ≥ 0. |
radius | number | 200 | Falloff reach in world units (Point / Spot). Range ≥ 0. |
direction | Vec2 | (0, 0) | Aim direction (Directional / Spot). |
innerAngle | number | 30 | Range 0–180. |
outerAngle | number | 45 | Range 0–180. |
shadowSoftness | number | 0 | Shadow softness (light-source size); 0 = hard edge. Range ≥ 0. |
shadowDistance | number | 0 | Directional shadow distance; 0 = no directional shadow. Range ≥ 0. |
meshShadows | boolean | false | Cast a shadow map over 3D meshes (Directional). |
shadowExtent | number | 0 | Shadow map coverage radius; 0 = fit the view. Range ≥ 0. |
environment | Asset<environment> | none | Baked environment (.esenv) this Ambient light casts. |
enabled | boolean | true |
Mesh2D
Arbitrary 2D geometry — your own vertices, indices and material — drawn like any other renderer.
Explained in graphics/drawing.
| Field | Type | Default | Notes |
|---|---|---|---|
texture | Asset<texture> | none | |
normalMap | Asset<texture> | none | Normal map (tangent space). Needs a mesh with normals. |
color | Color | #ffffff | Tint multiplied into the vertex colors (white = unchanged). |
layer | enum (sortingLayers) | 0 | Sorting layer — controls draw order across renderables. Range step 1. |
opaque | boolean | false | Opaque: no blending; writes and tests depth, so meshes occlude each other. |
cullBackfaces | boolean | false | Cull back faces: triangles facing away from the camera are skipped. |
lit | boolean | false | Receive 2D lights: Light2D entities light this mesh (flat normal). A custom material overrides this. |
parallax | Vec2 | (1, 1) | Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera). |
material | Asset<material> | none | |
enabled | boolean | true | |
mesh | Asset<mesh> | none | |
geometry | object | {"positions":[],"indices":[]} |
MeshSkin
The joint entities that deform a Mesh2D — an imported skin, in the order its bind matrices are in.
Explained in assets/models.
| Field | Type | Default | Notes |
|---|---|---|---|
joints | Entity | | Joint entities, in the order the mesh's bind matrices are in. |
PostProcessVolume
A stack of full-screen effects (bloom, vignette, colour grading) applied after the scene is drawn.
Explained in graphics/post-processing.
| Field | Type | Default | Notes |
|---|---|---|---|
effects | array | empty | |
isGlobal | boolean | true | |
shape | string | "box" | |
size | Vec2 | (5, 5) | |
priority | number | 0 | |
weight | number | 1 | |
blendDistance | number | 0 |
ShadowCaster2D
Marks a renderer as an occluder, so 2D lights cast shadows from its silhouette.
Explained in graphics/lighting.
| Field | Type | Default | Notes |
|---|---|---|---|
size | Vec2 | (32, 32) | Occluder box size in world units (centered on the entity). Range ≥ 0. |
enabled | boolean | true |
ShapeRenderer
A filled or stroked primitive — rectangle, circle, capsule — with no texture asset.
Explained in graphics/sprites.
| Field | Type | Default | Notes |
|---|---|---|---|
shapeType | enum | Circle | One of Circle, Capsule, RoundedRect. |
color | Color | #ffffff | |
size | Vec2 | (100, 100) | |
cornerRadius | number | 0 | Range ≥ 0. |
layer | enum (sortingLayers) | 0 | Range step 1. |
parallax | Vec2 | (1, 1) | Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera). |
enabled | boolean | true |
Sprite
Draws a texture in the world — tint, size, pivot, sorting layer, flipping, tiling and parallax.
Explained in graphics/sprites.
| Field | Type | Default | Notes |
|---|---|---|---|
texture | Asset<texture> | none | |
color | Color | #ffffff | Tint multiplied into the texture (white = unchanged). |
size | Vec2 | (100, 100) | |
pivot | Vec2 | (0.5, 0.5) | Anchor point the sprite rotates and scales about, as a fraction of its size (0.5,0.5 = centre). Values outside 0–1 sit off the sprite. |
uvOffset | Vec2 | (0, 0) | |
uvScale | Vec2 | (1, 1) | |
layer | enum (sortingLayers) | 0 | Sorting layer — controls draw order across sprites. Range step 1. |
lit | boolean | false | Receive 2D lights: Light2D entities light this sprite (flat normal). A custom material overrides this. |
flipX | boolean | false | |
flipY | boolean | false | |
tileSize | Vec2 | (0, 0) | |
tileSpacing | Vec2 | (0, 0) | |
parallax | Vec2 | (1, 1) | Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera). |
material | Asset<material> | none | |
enabled | boolean | true |
TrailRenderer
A ribbon trailing the entity as it moves, tapering and fading over its lifetime.
Explained in graphics/sprites.
| Field | Type | Default | Notes |
|---|---|---|---|
time | number | 0.5 | Seconds each trail point lives before it fades out of the tail. Range ≥ 0. |
minVertexDistance | number | 5 | Min world distance moved before a new trail point is recorded. Range ≥ 0. |
emitting | boolean | true | Record new points. False = freeze and let the streak fade in place. |
startWidth | number | 20 | Full ribbon width at the head (newest point). Range ≥ 0. |
endWidth | number | 0 | Full ribbon width at the tail (oldest point). Range ≥ 0. |
startColor | Color | #ffffff | Color at the head (newest point). |
endColor | Color | #ffffff00 | Color at the tail (oldest point) — usually alpha 0 to fade out. |
texture | Asset<texture> | none | |
blendMode | number | 0 | Blend mode: 0 Normal, 1 Additive (glow), 2 Multiply, … |
layer | enum (sortingLayers) | 0 | Sorting layer — controls draw order across renderables. Range step 1. |
material | Asset<material> | none | |
enabled | boolean | true |
Video
Plays a video stream onto a surface in the world or the UI.
Explained in graphics/video.
| Field | Type | Default | Notes |
|---|---|---|---|
source | Asset<video> | none | |
autoplay | boolean | true | |
loop | boolean | true | |
muted | boolean | true | |
volume | number | 1 | |
playbackRate | number | 1 | |
fitSize | boolean | true | |
enabled | boolean | true |