Sprite import settings
- Game Development course
- Beginner
- Lesson 57/83
- 4 min
Learn to add a sprite and set Multiple and Pixels Per Unit options.
Sprite import settings and PPU
Pixels Per Unit (PPU) dictates how many pixels correspond to 1 unit of distance in Unity world space. The default value is 100 (meaning 100 pixels = 1 Unity unit).
// In 16x16 pixel art, 1 Unity unit = 16 pixels
// Pixels Per Unit: 16In pixel art games, fixed PPU values like 16 or 32 are typically favored to maintain consistent character proportions.
Layer Ordering Logic
Layers render sequentially from top to bottom in settings: the top-most listed Sorting Layer renders first and appears farthest back; the bottom-most layer renders last and appears in front.
// Layer stack example:
// 1. Background (Floor) -> Order: 0
// 2. Characters (Player) -> Order: 10
// 3. Foreground (Grass) -> Order: 20A well-planned sorting structure provides a flawless sense of depth in 2D scenes.
Practice Print import settings
Assign 16 to ppu and "Point" to filter. Print PPU: 16 | Filter: Point to the console.
Starter code
using System;
class Program
{
static void Main()
{
// ppu ve filter değerlerini tanımlayıp yazdır
}
}Sample solution
using System;
class Program
{
static void Main()
{
int ppu = 16;
string filter = "Point";
Console.WriteLine("PPU: " + ppu + " | Filter: " + filter);
}
}Expected output
PPU: 16 | Filter: Point
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What should Filter Mode be set to in pixel art retro games to prevent blur and keep pixels crisp?
- Bilinear
- Trilinear
- Antialiased
- Point (no filter) Correct answer
Explanation: Point (no filter) disables interpolation around pixel edges, keeping retro artwork sharp and pixel-perfect.
2 Read pixel unit value
float ppu = sprite.____;
float ppu = sprite.pixelsPerUnit;
Explanation: A Sprite object's pixel density per world unit is accessed through the pixelsPerUnit property.
3 Import parameters
| Term | Meaning |
|---|---|
Pixels Per Unit |
Pixels fitting into one world unit |
Point (no filter) |
Filter keeping pixels sharp and crisp |
Sprite Mode Single |
Mode for a single standalone sprite |
Sprite Mode Multiple |
Mode for multiple sprite frames |