跳转到内容

图形组件

下面每个字段都由引擎自身的组件注册表推导而来——就是编辑器 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.

FieldTypeDefaultNotes
textstringempty
colorColor#ffffff
fontSizenumber1 Range ≥ 1.
alignenumLeft One of Left, Center, Right.
spacingnumber0
parallaxVec2(1, 1)Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera).
layernumber0 Range step 1.
fontAsset<font>none
enabledbooleantrue

CacheAsBitmap

Renders an expensive subtree once into a texture and reuses it until marked dirty.

Explained in graphics/sprites.

FieldTypeDefaultNotes
enabledbooleantrue
dirtybooleantrue
widthnumber256
heightnumber256

Camera

A view onto the world — projection, zoom, viewport rect, clear flags and render priority.

Explained in graphics/camera.

FieldTypeDefaultNotes
projectionTypeenumOrthographicOrthographic (2D) or Perspective projection. One of Perspective, Orthographic.
fovnumber60 Range 1–179.
orthoSizenumber540Half the visible height in world units (Orthographic). Range ≥ 0.
nearPlanenumber0.1 Range ≥ 0.
farPlanenumber1000 Range ≥ 0.
aspectRationumber1.77
isActivebooleantrue
prioritynumber0 Range step 1.
viewportVec4(0, 0, 1, 1)
clearFlagsnumber3Which buffers to clear before rendering this camera.
pixelPerfectbooleanfalseSnap the camera to the pixel grid for crisp pixel-art (Orthographic).
cullingMasknumber4294967295Which sorting layers this camera renders.
showFrustumbooleanfalseDraw 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.

FieldTypeDefaultNotes
minXnumber0
minYnumber0
maxXnumber0
maxYnumber0

Canvas

The design resolution and scale mode a scene is authored against — one per scene root.

Explained in core-concepts/screen.

FieldTypeDefaultNotes
designResolutionVec2(1920, 1080)
pixelsPerUnitnumber100World pixels per physics meter (Box2D + tile collider scale). Range ≥ 1.
scaleModeenumFixedHeightHow the canvas adapts the design resolution to the screen. One of FixedWidth, FixedHeight, Expand, Shrink, Match.
matchWidthOrHeightnumber0.50 matches width, 1 matches height (Match mode only). Range 0–1.
backgroundColorColor#000000
layerenum (sortingLayers)0Sorting 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.

FieldTypeDefaultNotes
targetnumber-1
offsetXnumber0
offsetYnumber0
deadzonenumber0
dampingnumber0.25

Light2D

A 2D light — point, directional, spot or ambient — that lit renderers and Lit2D materials receive.

Explained in graphics/lighting.

FieldTypeDefaultNotes
typeenumPointPoint, Directional, Ambient, or Spot. One of Point, Directional, Ambient, Spot.
colorColor#ffffff
intensitynumber1Brightness multiplier of the light. Range ≥ 0.
radiusnumber200Falloff reach in world units (Point / Spot). Range ≥ 0.
directionVec2(0, 0)Aim direction (Directional / Spot).
innerAnglenumber30 Range 0–180.
outerAnglenumber45 Range 0–180.
shadowSoftnessnumber0Shadow softness (light-source size); 0 = hard edge. Range ≥ 0.
shadowDistancenumber0Directional shadow distance; 0 = no directional shadow. Range ≥ 0.
meshShadowsbooleanfalseCast a shadow map over 3D meshes (Directional).
shadowExtentnumber0Shadow map coverage radius; 0 = fit the view. Range ≥ 0.
environmentAsset<environment>noneBaked environment (.esenv) this Ambient light casts.
enabledbooleantrue

Mesh2D

Arbitrary 2D geometry — your own vertices, indices and material — drawn like any other renderer.

Explained in graphics/drawing.

FieldTypeDefaultNotes
textureAsset<texture>none
normalMapAsset<texture>noneNormal map (tangent space). Needs a mesh with normals.
colorColor#ffffffTint multiplied into the vertex colors (white = unchanged).
layerenum (sortingLayers)0Sorting layer — controls draw order across renderables. Range step 1.
opaquebooleanfalseOpaque: no blending; writes and tests depth, so meshes occlude each other.
cullBackfacesbooleanfalseCull back faces: triangles facing away from the camera are skipped.
litbooleanfalseReceive 2D lights: Light2D entities light this mesh (flat normal). A custom material overrides this.
parallaxVec2(1, 1)Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera).
materialAsset<material>none
enabledbooleantrue
meshAsset<mesh>none
geometryobject{"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.

FieldTypeDefaultNotes
jointsEntityJoint 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.

FieldTypeDefaultNotes
effectsarrayempty
isGlobalbooleantrue
shapestring"box"
sizeVec2(5, 5)
prioritynumber0
weightnumber1
blendDistancenumber0

ShadowCaster2D

Marks a renderer as an occluder, so 2D lights cast shadows from its silhouette.

Explained in graphics/lighting.

FieldTypeDefaultNotes
sizeVec2(32, 32)Occluder box size in world units (centered on the entity). Range ≥ 0.
enabledbooleantrue

ShapeRenderer

A filled or stroked primitive — rectangle, circle, capsule — with no texture asset.

Explained in graphics/sprites.

FieldTypeDefaultNotes
shapeTypeenumCircle One of Circle, Capsule, RoundedRect.
colorColor#ffffff
sizeVec2(100, 100)
cornerRadiusnumber0 Range ≥ 0.
layerenum (sortingLayers)0 Range step 1.
parallaxVec2(1, 1)Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera).
enabledbooleantrue

Sprite

Draws a texture in the world — tint, size, pivot, sorting layer, flipping, tiling and parallax.

Explained in graphics/sprites.

FieldTypeDefaultNotes
textureAsset<texture>none
colorColor#ffffffTint multiplied into the texture (white = unchanged).
sizeVec2(100, 100)
pivotVec2(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.
uvOffsetVec2(0, 0)
uvScaleVec2(1, 1)
layerenum (sortingLayers)0Sorting layer — controls draw order across sprites. Range step 1.
litbooleanfalseReceive 2D lights: Light2D entities light this sprite (flat normal). A custom material overrides this.
flipXbooleanfalse
flipYbooleanfalse
tileSizeVec2(0, 0)
tileSpacingVec2(0, 0)
parallaxVec2(1, 1)Parallax scroll factor (1 = with world, <1 = slower, 0 = locked to camera).
materialAsset<material>none
enabledbooleantrue

TrailRenderer

A ribbon trailing the entity as it moves, tapering and fading over its lifetime.

Explained in graphics/sprites.

FieldTypeDefaultNotes
timenumber0.5Seconds each trail point lives before it fades out of the tail. Range ≥ 0.
minVertexDistancenumber5Min world distance moved before a new trail point is recorded. Range ≥ 0.
emittingbooleantrueRecord new points. False = freeze and let the streak fade in place.
startWidthnumber20Full ribbon width at the head (newest point). Range ≥ 0.
endWidthnumber0Full ribbon width at the tail (oldest point). Range ≥ 0.
startColorColor#ffffffColor at the head (newest point).
endColorColor#ffffff00Color at the tail (oldest point) — usually alpha 0 to fade out.
textureAsset<texture>none
blendModenumber0Blend mode: 0 Normal, 1 Additive (glow), 2 Multiply, …
layerenum (sortingLayers)0Sorting layer — controls draw order across renderables. Range step 1.
materialAsset<material>none
enabledbooleantrue

Video

Plays a video stream onto a surface in the world or the UI.

Explained in graphics/video.

FieldTypeDefaultNotes
sourceAsset<video>none
autoplaybooleantrue
loopbooleantrue
mutedbooleantrue
volumenumber1
playbackRatenumber1
fitSizebooleantrue
enabledbooleantrue