Easily change sprite size in Unity by adjusting the Pixels Per Unit setting on the sprite texture asset or by scaling the GameObject in your scene.
Understanding how sprites are sized in Unity is key to controlling their appearance in your game world. The primary way Unity determines a sprite's size is through its Pixels Per Unit (PPU) setting found in the sprite's import settings.
Adjusting Sprite Size via Pixels Per Unit
The Pixels Per Unit value defines how many pixels of your sprite texture correspond to one Unity world unit.
- Higher Pixels Per Unit: The sprite will appear smaller in the game world because more pixels are packed into a single Unity unit.
- Lower Pixels Per Unit: The sprite will appear larger in the game world because fewer pixels are spread across a single Unity unit.
This method is ideal for setting the base size of your sprite asset that will be consistent whenever you use it.
Steps to Change Pixels Per Unit:
- Select the sprite texture file in your Project window.
- Look at the Inspector window.
- Change the 'Texture Type' to
Sprite (2D and UI)
. - Locate the Pixels Per Unit field. The default is typically 100.
- Enter your desired value. For example, as demonstrated in the reference, you might set it to 500 to make the sprite significantly smaller.
- You might also adjust the Max Size setting (e.g., set Max Size to around 256 as shown in the reference) which relates to the texture resolution Unity imports. While PPU controls the world size based on pixels, Max Size limits the texture's dimensions.
- Click the Apply button at the bottom of the Inspector.
After applying, the sprite's size in the Scene view and Game view will update automatically.
Example: If you have a 100x100 pixel sprite:
- At 100 PPU, it will be 1x1 Unity units in size.
- At 50 PPU, it will be 2x2 Unity units in size.
- At 200 PPU, it will be 0.5x0.5 Unity units in size.
- According to the reference, setting PPU to 500 makes a balloon sprite "automatically become smaller".
Scaling the GameObject
Another way to change the visual size of a sprite is by scaling the GameObject it's attached to in your scene.
This method scales the sprite instance after the PPU setting is applied. It's useful for:
- Making individual instances of a sprite larger or smaller than its base size.
- Animating size changes.
- Adjusting the size based on gameplay factors.
Steps to Scale a GameObject:
- Select the GameObject containing the Sprite Renderer component in your Hierarchy or Scene view.
- Look at the Inspector window.
- Find the Transform component.
- Adjust the Scale properties (X, Y, Z).
- Scaling X and Y proportionally (e.g., X=2, Y=2) will make the sprite larger without distortion.
- Scaling X and Y disproportionately (e.g., X=2, Y=1) will stretch or squash the sprite.
Method | Affected Level | Best For |
---|---|---|
Pixels Per Unit | Sprite Asset (texture) | Setting base size; consistency across uses |
GameObject Scale | Sprite Instance (in scene) | Instance-specific size tweaks; animation; runtime changes |
By utilizing both Pixels Per Unit for base sizing and GameObject Scale for instance adjustments, you have flexible control over how your sprites appear in your Unity projects.