9-slicing is a 2D technique that allows you to resize a sprite without creating multiple sprites for all the different sizes.
To use 9-slicing, you create a sprite with nine sections. The different sections stretch or repeat in different ways to keep the sprite in proportion.
9-slicing is useful for creating patterns, walls, or floors in a 2D environment.
Note: You can only use a Box Collider 2D or Polygon Collider 2D component to add a collision shape to a 9-sliced sprite. For more information, refer to 9-slice a sprite.
If you don’t use 9-slicing, the entire sprite stretches when you change its dimensions.
With 9-slicing, you can resize the sprite using sliced mode or tiled mode.
In sliced mode, the sprite does the following:
In tiled mode, the sprite does the following:
You can control how Unity repeats the texture across the resized sprite. For more information, refer to 9-slice a sprite.