Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Official 2D Pixel Perfect 5.0 released for Unity 2021.1

Discussion in '2D' started by rustum, May 10, 2021.

  1. rustum


    Unity Technologies

    Feb 14, 2015
    2D Pixel Perfect 5.0 released for Unity 2021.1

    2D Pixel Perfect.png

    About Pixel Perfect Camera
    The 2D Pixel Perfect package contains the Pixel Perfect Camera component, which ensures your pixel art remains crisp and clear at different resolutions, and stable in motion.

    It is a single component that makes all the calculations Unity needs to scale the viewport with resolution changes, so that you don’t need to do it manually. See the 2D Pixel Perfect documentation here.

    Getting Started
    In an existing project in Unity 2021.1:
    1. Open Package Manager by going to Window > Package Manager
    2. Select Unity Registry in the Packages drop-down menu.
    3. Choose 2D Pixel Perfect 5.0 from the list and click on Install at the bottom right of the Package Manager window. 2D Pixel Perfect Package.png
    Creating a new project in Unity 2021.1 by selecting the 2D Template in Unity Hub will also install 2D Pixel Perfect 5.0 by default.

    Explore the Samples
    2D Pixel Perfect comes with Samples showing the features in action.

    To get the samples:
    1. Open Package Manager by going to Window > Package Manager
    2. Select Unity Registry in the Packages drop-down menu.
    3. Expand the Samples section.
    4. Click the Import button next to the sample you want to import. 2D Pixel Perfect Samples.png

    Important Note:
    As a reminder: While the stand-alone Pixel Perfect Camera component will continue to receive bug fixes, the Pixel Perfect Camera component in the Universal RP is the new home for Pixel Perfect Camera. New features will only be added to the component in Universal RP. Please join the discussion for the 2D Graphics in URP here.

    What can you do?
    Try it out and let us know what you think of the package. We want to know what works as expected and what doesn’t.
  2. castor76


    Dec 5, 2011

    I am using URP 2DRenderer, and I am getting this warning. Is this mean this package is not working with the URP 2Drenderer? Have I misunderstood something?
    dayzex0 and masalootten like this.
  3. Viole


    Dec 29, 2015
    Good job on the package so far. One feature I would like to suggest though:
    Pixel Perfect package absolutely needs an option to upscale render texture and still have a smooth camera (that moves in the higher resolution). There's a huge demand for that kind of thing in pixel art gamedev community. Here's a video describing the theory behind it:

    Personally, I would also like to be able to upscale just some layers and not others, but the feature above is far more important. Without it, every upscaled game feels super jittery. In many cases, it makes the upscaling feature unusable.
  4. hawken


    Aug 22, 2013
    Thanks for keeping this going, it's very handy!

    I've not been able to use in a project yet though due to the Canvas resolution missmatch issue, was this ever addressed? I feel it really holds back the asset for 2D games in a production environment using LTS Unity versions. (Unity 2020.3)

    I make 2d pixel art games almost exclusively and I'm still using a custom render texture solution because of this issue.
    Last edited: Nov 9, 2021
  5. vambier


    Oct 1, 2012
    You are right, this is something that is missing from Unity. Let's hope this is something that wil be added.
  6. useraccount1


    Mar 31, 2018
    While the package is great and saves a lot of time, I have noticed some basic use cases that aren't covered by the tool.

    One thing already mentioned is that the tool doesn't support a smooth camera. Another issue I had to fix by myself is the lack of proper support for various screen ratios by default.

    For example, I'm making a game targeted at desktop computers, so in my case, people will play with monitors whose ratios range from 16:10 to 21:9. There are cases when the screen might get wider or thinner, but they are so rare we don't consider them seriously. I think it's worth noting that the steam deck also has a 16:10 screen.

    The tool I have made simply checks the scale of the game's window, then the script takes the Y value of the Reference Resolution (as it is constant in my case), then the script applies the correct X in Reference Resolution. This works perfectly, actually, this is the only solution that works properly in my case. I have tried to do the same by changing values in "Crop Frame" and "Grid snapping", but in my opinion, the results are unacceptable.

    The second feature I have added is the support for zooming in and out by changing Reference Resolution. This is the wrong approach, as how far you can zoom out depends on the game's window resolution (the Reference resolution can't be higher than the game's resolution).

    My point is that it would be nice to have these features by default.
  7. juicedup


    Aug 18, 2019
    Is it possible to edit the render texture that the pixel perfect creates when upscale render texture is ticked?
    edit: to add on to this, i'm wondering if other 2D tools will get opened up for the user to customize? such as being able to edit how unity renders shadows
    Last edited: Apr 24, 2022
    Zanthous likes this.