Component · twoD
Sprite
A batched sprite with optional normal-mapped 2D illumination.
Fields
atlas
option<asset>Atlas asset reference, resolved to a resident texture at extraction.
default null
region
stringStable region name in the atlas.
default ""
normalAtlas
option<asset>Optional normal atlas, using the same rectangles.
default null
size
vec2Desired world size in metres; zero selects source size / pixels per metre.
default [0,0]
tint
vec4Linear, straight-alpha tint.
default [1,1,1,1]
sortingLayer
i32Painter's sorting layer; lower draws first.
default 0
order
i32Painter's order within a layer; stable identity breaks ties.
default 0
flipX
boolMirror horizontally about the pivot.
default false
flipY
boolMirror vertically about the pivot.
default false
nineSlice
boolApply the region's nine-slice borders when resizing.
default false
lit
boolOpt into normal-mapped local lights and geometric shadows.
default false
parallax
vec2Parallax factor; one follows the world, zero follows the camera.
default [1,1]
Usage
Every edit is an undoable command: from the CLI as below, or the same JSON from an agent over MCP. See component.add and property.set.
Add it
ara do component.add -p entity=name:Crate -p component=Sprite --why "Add Sprite"Set a field
ara do property.set -p entity=name:Crate -p path=Sprite.atlas -p value=null --why "Tune Sprite"In a scene document
{
"Sprite": {
"atlas": null
}
}From C#
/// <summary>Face a sprite toward leftward movement.</summary>
public static void UseSprite(Entity entity, in Tick tick)
{
ref var component = ref World.Get<Sprite>(entity);
component.FlipX = true;
}From C#
Scripts read and write it with Get<Sprite>(); see the Sprite struct.