Skip to main content

Sprites

A sprite is a flat picture standing in your 3D world: a coin, a tree, a character, a sign. It can have several frames that play as an animation. You draw it in the built-in sprite editor, or import any image, and place it like any other object. Sprites can have a physics collider cut to their shape, so a drawn hero can stand on a floor and bump into walls.

Make a sprite​

Open the Assets tab, tap + New → Sprite, pick a size (32 to 2048 px, or Custom… such as 300 x 200) and give it a name. The painter opens straight away on the first frame.

The painter on a new 256 × 256 sprite
The painter on a new 256 × 256 sprite

Have a picture made of equal squares (a character sheet or a tile set)? + New → Sprite sheet from an image… cuts it into frames: see Tilemaps.

Already have a single picture? Drag an image file onto the 3D view. It becomes a sprite object right where you drop it. Any texture in your Files can be used as a sprite too.

The sprite editor​

The editor has four tabs. Save (top right) saves the sprite. Closing with ✕ or Back asks first when you have unsaved changes, and the painter does the same when you drew something.

Frames​

Three frames of a bouncing ball
Three frames of a bouncing ball

A strip of thumbnails shows every frame. Tap one to select it.

ButtonWhat it does
+Add an empty frame after this one.
⧉Duplicate this frame: the quick way to start the next step of an animation.
🗑Delete this frame.
← →Move this frame earlier or later.
▶ / ■Play the animation here.
fpsFrames per second of the animation (1 to 60).

Under the strip:

  • 🖌️ Draw opens the painter on this frame (brushes, layers, colors, undo). Tap Done in the painter to come back to the sprite editor; a Saving… spinner shows while it works. For pixel art use the Pixel brush. The paint bucket and the gradient, text and shape tools are in the tool menu under the brush icon (top left).
  • 👁 Onion skin shows the previous frame as a faint picture on top of the one you draw, so each frame follows the last. It sits above your drawing, so a bucket fill never hides it, and it is never saved into the frame. There is the same 👁 Onion skin button (yellow when on) in the corner of the painter, and the two stay in step. The first frame has no previous frame, so nothing shows there.
  • ⬇ Import puts a picture from your device into this frame, scaled to fit.

You can tap the big picture to draw too. All frames are saved together in one picture (a sprite sheet, frames side by side, at most 4096 px wide).

Animations​

One sprite can hold several animations, such as Idle, Walk and Jump: draw all their frames in the strip, then name which frames belong to each one.

An animation covering frames 1 to 3
An animation covering frames 1 to 3

Tap + Animation to add one. It starts as the frame you are on. Each animation has:

FieldWhat it does
NameWhat you call it from events and scripts, e.g. Walk. Names are not case-sensitive.
Frames … to …The first and last frame, both included. The strip highlights them.
fpsIts own speed. Empty uses the sprite's fps from the Frames tab.
LoopWhether it repeats when the sprite starts with it (see Play on start below).

Select an animation and press ▶ to see just those frames. Inserting, deleting or moving a frame keeps the animations on the same pictures.

Origin​

The origin is the point of the picture that sits at the object's position, and what it turns around. Pick one of the nine spots, or tap or drag on the picture to put it anywhere. A character usually stands on bottom middle, so its feet touch the ground; a coin spins around middle.

Origin at the bottom middle
Origin at the bottom middle

Collision​

The collision shape is a polygon around what is solid.

ButtonWhat it does
▢ BoxThe whole frame.
✨ AutoTraces round what you drew in every frame, notches and all, in up to 8 points.
🗑 PointDelete the selected corner.
↺ ClearNo shape: the sprite is a plain box.
✨ Auto outlines what is drawn
✨ Auto outlines what is drawn

Drag a dot to move a corner. Tap or drag anywhere else on the picture to add a corner on the nearest edge (up to 32).

Add it to the scene​

Objects → + Add, under Sprites: pick one of your sprites, or New sprite… to draw one first. Or drag a sprite from Files into the 3D view: it lands on the surface under your finger.

In the Inspector the Sprite card has:

SettingWhat it does
SpriteWhich picture. 🖌️ New sprite draws a new one, ✏ Edit reopens the editor on this one.
▶ Preview animationPlays the frames in the 3D view, without pressing Play (only for sprites with several frames).
Pixels per meterHow big it is. 0 = automatic: about 2 m on its longest side. 100 = 100 pixels per meter.
ColorTints the picture. White leaves it as drawn.
Opacity1 = solid, 0 = invisible.
Flip X / Flip YMirror the picture, for example to make a character face left.
Face cameraNo, Always (a billboard, always turned to the camera), or Upright (turns around the vertical axis only, so trees don't tilt).
Sort orderHigher numbers draw in front of lower ones when sprites overlap.
EdgesSmooth blends pixels. Pixel (hard) keeps pixel art crisp.
AnimationWhich animation the sprite starts with. All frames plays the whole strip. Shown only when the sprite has animations.
Play on startFrames start playing when the game starts.
LoopStart over after the last frame. An animation's own Loop setting wins when the sprite starts with it.
Speed1 = the fps set in the editor, 2 = twice as fast.
Start frameThe frame shown first (0 = first).
Collider depth (m)How thick the collision shape is, front to back.
Render textureShows a camera's live picture instead (see render textures).
Normal mapA second picture with the surface's bumps, for 2D lights with Normal Maps.
MaterialLit (default): 2D lights light it when the scene has any. Unlit: always as drawn.
card sprite

3D lights don't light sprites: they show their own colours, unless the scene has 2D lights.

Physics and collisions​

Give the object a Rigid body and set the collider to Auto. Auto uses the collision polygon you drew. On an object that never moves (no Rigid body, or a Static one), a concave outline keeps its shape: an L, an arch or a ramp with a hollow underneath is solid only where you drew it. On a moving (Dynamic) body, or when the collider is a trigger, a concave outline is wrapped in its smallest convex shape. There is one polygon per sprite, the same for all frames.

To give one object an outline of its own (other objects with the same picture keep theirs), set its collider to Polygon (2D outline) and drag the points in the scene view: see Polygon collider. Its concave shape holds on moving bodies too.

Levels and 2D games​

Paint whole levels from a sheet of tiles with a tilemap, and see 2D games for a side camera, a platformer hero that flips and plays Idle / Walk / Jump / Fall by name, and the ready-made template.

Events and scripts​

The animation blocks that work on models work on sprites too:

BlockWhat it does
Play animationPlays the animation with that name, e.g. Walk. Asking for the one already playing keeps it going, so Every tick → Play animation Walk is fine. A sprite without named animations plays all its frames whatever name you give.
Stop animationFreezes on the frame showing.
Set animation speed1 = normal, 2 = double.
Is playing animationTrue while that animation plays.
On animation finishedA play-once animation reached its last frame. Leave the name empty for any.
Show frame … of …Show one frame and stop. Frame 0 is the first. Use it for states such as a door or a health icon.

In code:

entity.setSpriteFrame(2); // show frame 2 and stop
entity.getSpriteFrame(); // the frame now showing
entity.getSpriteFrameCount(); // how many frames

entity.playAnimation('Walk'); // play the animation called Walk
entity.playAnimation('Jump', false); // once, holding the last frame
entity.getAnimation(); // 'Jump' while it plays
entity.getAnimationNames(); // ['Idle', 'Walk', 'Jump']
entity.setAnimationSpeed(2);

const sprite = entity.component('sprite');
sprite.flipX = player.vx < 0; // face the way it walks
sprite.billboard = 'upright';

Settings you can change on component('sprite'): flipX, flipY, color, opacity, billboard, speed, loop and animation (setting it plays that animation).

Good to know​

  • Show frame counts over the whole strip, not inside an animation, and leaves the animation it was playing.
  • The collision polygon is one per sprite (concave only for objects that never move), and it doesn't change from frame to frame or between animations. A Polygon collider is one per object instead.
  • The 3D view shows one still frame (the Start frame, or the first frame of the chosen animation) until you press ▶ Preview animation or Play.
  • Large sprites cost memory: a 2048 × 2048 frame is 16 MB on the GPU. Smaller is faster on phones.