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.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

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

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

  1. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    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:
    335
    We have a sample scene here with a custom UI scaler script that might help you.
     
  3. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    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:
    521
    Does this custom scaler work on all of the settings or does it have to use constant pixel size?