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. Dismiss Notice

Question Is there a secret to make pixel perfect UI?

Discussion in 'UGUI & TextMesh Pro' started by sildeflask, Aug 17, 2023.

  1. sildeflask

    sildeflask

    Joined:
    Aug 16, 2023
    Posts:
    142
    I have pixel perfect checkmarked on UI

    I have all the canvas scaler on good settings, camera space, scale with height, 640x360 res

    my ppu is also on good settings

    my sprites are in general looking good, 1 pixel = 4 pixels on 1920x1080, all is good

    but when it comes the time to align things, its hell, the small float movements are not smooth and only work when you move more than a certain amount. Changing the y from 0.1 to 0.2 doesnt move anything and then on 0.4 suddenly it moves a lot, there is no inbetween. Because of this some sprites are always misaligned

    I try to move a anchor on a sprite but on 0.3y is one pixel too much 0.4y is 2pixels too low,
    there is no inbetween 0.333 is the same as 0.3 and 0.42 is the same as 0.4

    why is it like this. I cant even check how it looks truly without making a build, just to see if my 0.1 movement worked to align 1 pixel, and everytime my whole hierarchy collapses and I have to manually expand it back, its HELL

    I dont care about pixel perfect anymore, how can I make subpixel movement that just pretends to be pixel perfect??
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,563
    This doesn't make sense.

    Pixel perfect generally means in a 3D world you are "pretending" that the screen only has a far smaller number of pixels across.

    This obviously means you cannot move smoothly. For instance, if the screen is 100 x 50 pixels, the least you can move is 1/100th of the screen or 1/50th of the screen.

    Otherwise, just turn off smooth filtering, blow your sprites up big enough to get the pixels you want, and get back to making games. :)
     
  3. sildeflask

    sildeflask

    Joined:
    Aug 16, 2023
    Posts:
    142
    here is an image of the problem

    Untitled.png
    i am changing the rect transform of the green image, trying to line up with the red

    the recttransform is not letting any movement in between

    just from 0.0001 of movement it jumps 3 pixels

    from 0 to -0.6541 NO MOVEMENT

    then suddenly at -0.6542 jump down 3 pixels

    I dont know what to do

    (even in the scene view it stutter steps across positions like this)
    I know that normally everything looks good on scene view, but this is not the case