Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

UI scale to integer sizes to match 2018.2's pixel perfect camera?

Discussion in 'Unity UI & TextMesh Pro' started by Zebbi, Jul 12, 2018.

  1. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    85
    I've gotten the pixel perfect camera script in 2018.2 to work, but on certain aspect-ratios or resolutions, my camera game area appears a lot smaller than the size of the screen with black bars around the edge to keep the pixels perfect. Is there a way of enforcing pixel perfection on the UI as well? Otherwise the UI resizes to match the screen size with a tiny game area in the middle of the screen on non-integer divisible screen sizes.
     
  2. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    123
    We have a sample scene here with a custom UI scaler script that might help you.
     
  3. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    85
    Thanks for that! So, it looks okay with some elements, but for instance, grid layout seems to be stretching very oddly with constant pixel size. Does constant pixel size have to be used in the custom scaler for the pixel-perfection to work? Do other elements in the canvas have to be set up in a specific way?
     
  4. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    85
    Does this custom scaler work on all of the settings or does it have to use constant pixel size?