- Home /
flickering lines when moving camera(unity 2d)
when i'm trying to move my camera these lines start to appear, my sprites are 32*32 and pixels per units is set to 32(so 1sprite=1unit)
Are you moving the landscape sprites?
Are you moving the camera in LateUpdate() ? You should if you are not.
Do all your Sprites(brown block, green block etc) come from one single image(sheet)? If so is there any space between them on this image?
Does it happen when you do a full build and run standalone? I have this problem running in the editor, but it goes away in a build.
Looks like it's just subpixel movement/ floating point error causing those lines. Even if your sprites are 1 world unit in size and you place them on a grid perfectly spaced 1 unit apart in x or y, you can still end up with these small errors.
i just tested standalone and it seems to be fixed, tnx Dave
i just tested it some more and i now get this
Answer by Dave-Carlile · Dec 17, 2014 at 01:38 PM
Create a new material, set the shader to Sprites/Default
, and check the Pixel Snap
box. Use that material for your sprites.
If you want to be completely pixel perfect, where each pixel on your sprite always matches up perfectly with a pixel on the screen, you'll need to do some more work...
copied from the link in case it ever goes dead - Camera Size is Orthographic Size
Camera Size = x / ((( x / y ) * 2 ) * s )
Where:
x = Screen Width (px)
y = Screen Height (px)
s = Desired Height of Photoshop Square (px)
If you allow zooming and such by changing the orthographic size... well, I haven't figure out how to do that perfectly yet - I believe it involves only allowing certain multiples of orthographic size - probably powers of 2.