Pixel Perfect
Overview
The Pixel Perfect extension makes sure your pixel-art sprites are always displayed as crisp as possible. If you’re doing a game with pixel-art you’ll probably want to use this extension.
Editor
Parameters:
Pixels per Unit
: How many pixels in your sprite should correspond to one unit in the worldViewport Auto-Scale
:None
: The camera won't automatically scaleFloor
: The camera will automatically calculate the best scale across all resolutions based on the game viewport, using the floor methodCeil
: The camera will automatically calculate the best scale across all resolutions based on the game viewport, using the ceil methodRound
: The camera will automatically calculate the best scale across all resolutions based on the game viewport, using the round method
Game Viewport (pixels)
: Set it that if the screen was of this size, each pixel on the screen would correspond to a pixel on your art. This should correspond to your design time resolution of your assetsZoom
: The zoom level of the cameraSnap Movement to Grid
: If enabled, the camera and the sprites will snap to the grid. Might create some stuttering on your moving objects, especially if you’re using a large grid. Good for retro-looking games but might look weird on most casesDraw Grid
: If enabled, ProCamera2D will draw a grid representing your “pixel” size. It will only be visible if the grid step is large enough
Pixel Perfect Sprite Editor
Besides enabling the Pixel Perfect extension, you also need to add the ProCamera2DPixelPerfectSprite
component to all the sprites that you want to assure are pixel-perfect.
Parameters:
Is A Moving Object
: If enabled, the object position will be aligned to pixel perfect every frame. To improve performance, enable only if the object (or its parent) moveUse Parent Movement
: Enable if you’re moving the parent of this sprite instead of the sprite itselfLocal Position
: If you’re using the parent movement, you have to set this sprite local position using this valueSprite Scale
: The scale of this sprite. A scale of 0 means that ProCamera2D won’t automatically resize this sprite to it’s pixel-perfect size (but it will still align it to the pixel grid)
Considerations
To achieve pixel perfect results you should also, on your render settings:
- Turn off anisotropic filtering
- Turn off anti aliasing
And on your sprites:
- Ensure you are using a lossless compression
- Turn off mipmapping
- Use Point sampling