AlexanderOcias / UnityPixelArtCamera

Easy pixel art camera rendering in Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unity Pixel Art Camera

Solves the key issues with pixel art rendering in Unity with no headaches.

  1. Displays sprites without distortion
  2. Enforces a consistent pixel size
  3. Conforms to a pixel grid
  4. Retains position stability while camera moves
  5. Fills the screen in a predictable way
  6. Avoids floating point precision errors

Setup

It’s super easy to get started:

  1. Put the PixelArtCamera component anywhere in your scene (I recommend on your camera)
  2. Connect the Camera and Canvas in the appropriate fields if they’re not automatically filled in.
  3. Set the resolution on the PixelArtCamera component to your preference (and match the Pixels Per Unit to your texture imports, if you haven’t left it on the default ‘100’.)
  4. Put a material using the ‘Ocias/Pixel Art Sprite’ shader on your sprites.

That’s it!

FAQs

  • Why is my font not displaying correctly?

    Make sure you configure its import settings for pixel art. Set the asset's font size to the designed value, set the rendering mode to raster, and make sure the text object uses the same font size.

  • Why is my world-space canvas not displaying correctly?

    It may not be matching your game's pixels-per-unit settings. Set the scale of your world-space canvas to (1 / Pixels-per-unit).

About

Easy pixel art camera rendering in Unity


Languages

Language:ShaderLab 55.0%Language:C# 45.0%