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:
- Open the Hierarchy window.
- Select Add object (+) or right-click.
- Select 2D Object.
The following 2D objects are available.
Object | Description |
|---|---|
| Sprite | A flat image. |
| World Text | Text placed in the scene, not on the screen's UI. |
| Tilemap | A grid you paint tiles onto. Choose Rectangular, Hexagonal Flat Top, Hexagonal Point Top, Isometric, or Isometric Z as Y. |
| Particle System | Effects 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 |
|---|---|
| Sprite | Sets the image to display. |
| Color | Sets the color to tint the sprite. |
| Flip X | Flips the sprite horizontally. |
| Flip Y | Flips the sprite vertically. |
| Draw Mode | Sets 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. |
| Size | Sets the size to draw the sprite at. Appears when Draw Mode is Sliced or Tiled. |
| Tile Mode | Sets 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 Layer | Sets the layer to sort the sprite in. Select Add Sorting Layer in the list to make a new layer. |
| Order in Layer | Sets 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 Type | Sets 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. |
| Mass | Sets how heavy the object is. A heavier object is harder to push. |
| Gravity Scale | Sets how strongly gravity affects the object. |
| Linear Damping | Sets how quickly the object slows down as it moves, like air resistance. |
| Angular Damping | Sets how quickly the object stops spinning. |
| Collision Detection | Sets 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. |
| Interpolate | Sets 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 Position | Stops the object from moving left and right (X) or up and down (Y). |
| Freeze Rotation | Stops 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 |
|---|---|
| BoxCollider2D | A collider you can use to define rectangular shapes. |
| CircleCollider2D | A collider you can use to define circular shapes. |
| CapsuleCollider2D | A collider you can use to define a capsule shape. |
| PolygonCollider2D | A polygon that fits the shape of the object. |
| EdgeCollider2D | A line or series of lines. |
| CompositeCollider2D | Combines multiple colliders into one. |
| TilemapCollider2D | Gives tilemaps collisions. |