Documentation

Unity Spark

Open Unity Spark

Unity Spark

2D objects and components reference

Find the 2D objects you can add and the properties of the SpriteRenderer, Rigidbody2D, and 2D collider components.
Read time 3 minutesLast updated 3 hours ago

Use this reference to find the 2D objects you can add to a scene and the properties of the main 2D components in the Inspector window.
To add these objects and components, refer to Add and edit sprites, Paint levels with tilemaps, and Add 2D physics to objects.

2D objects

To add a 2D object:
  1. Open the Hierarchy window.
  2. Select Add object (+) or right-click.
  3. Select 2D Object.
The following 2D objects are available.

Object

Description

SpriteA flat image.
World TextText placed in the scene, not on the screen's UI.
TilemapA grid you paint tiles onto. Choose Rectangular, Hexagonal Flat Top, Hexagonal Point Top, Isometric, or Isometric Z as Y.
Particle SystemEffects such as sparks or smoke.

SpriteRenderer properties

Select a sprite object to view its SpriteRenderer component in the Inspector window. The SpriteRenderer component contains the following properties.

Property

Description

SpriteSets the image to display.
ColorSets the color to tint the sprite.
Flip XFlips the sprite horizontally.
Flip YFlips the sprite vertically.
Draw ModeSets how to draw the sprite. Simple draws the sprite as-is. Sliced draws a 9-sliced sprite, which can stretch without distorting corners. Tiled repeats the sprite to fill the area. Sliced and Tiled keep the corners only of a sprite that has a border.
SizeSets the size to draw the sprite at. Appears when Draw Mode is Sliced or Tiled.
Tile ModeSets how a tiled sprite fills its size. Continuous repeats it evenly, and Adaptive repeats it only when the size stretches past the Stretch Value. Appears when Draw Mode is Tiled.
Sorting LayerSets the layer to sort the sprite in. Select Add Sorting Layer in the list to make a new layer.
Order in LayerSets the order of the sprite within its layer. Higher numbers draw on top.

Rigidbody2D properties

The Rigidbody2D component contains the following properties.

Property

Description

Body TypeSets how physics moves the object. Dynamic objects fall and get pushed, like a player. Kinematic objects move only when a script moves them, like a moving platform. Static objects never move, like a wall.
MassSets how heavy the object is. A heavier object is harder to push.
Gravity ScaleSets how strongly gravity affects the object.
Linear DampingSets how quickly the object slows down as it moves, like air resistance.
0
means it doesn't slow down.
Angular DampingSets how quickly the object stops spinning.
Collision DetectionSets how Unity detects collisions between 2D colliders. The options are Discrete and Continuous. Discrete is faster, but very fast objects, such as bullets, might pass through walls. Continuous uses more processing, but stops fast objects from passing through.
InterpolateSets whether to smooth the object's movement when it appears jittery. Interpolate smooths movement using where the object was. Extrapolate smooths it using where the object is likely to go next.
Freeze PositionStops the object from moving left and right (X) or up and down (Y).
Freeze RotationStops the object from turning (Z), so it can't tip over.

2D colliders

A collider is an invisible shape that physics uses to tell when objects touch. Each collider has an Is Trigger option, which lets objects pass through the collider while still detecting them. For how to use Is Trigger, refer to Make a trigger. The following 2D colliders are available.

Collider

Description

BoxCollider2DA collider you can use to define rectangular shapes.
CircleCollider2DA collider you can use to define circular shapes.
CapsuleCollider2DA collider you can use to define a capsule shape.
PolygonCollider2DA polygon that fits the shape of the object.
EdgeCollider2DA line or series of lines.
CompositeCollider2DCombines multiple colliders into one.
TilemapCollider2DGives tilemaps collisions.

Additional resources