[answered - sorta] 2D Roguelike tutorial - how to fix black dotted line between middle rows without moving the camera
Hi all, I'm doing the 2D roguelike tutorial and noticed a weird black dotted line between the 4th and 5th rows of game tiles. It's 1 pixel thick so it's kind of hard to see but here's a pic:
It seemed pretty similar to this ask so I tried doing what they said (editing the material of the sprite renderer to snap-to-pixel) and I got that line between every row rather than just between the middle two rows.
Then I realised that actually the line is there in the tutorial videos as well! After some thought about what was special about that row I tried moving the camera a bit, and the line goes away. So I guess that when the camera is right above two tiles that don't overlap, sometime it renders a gap even if the tiles don't have a gap? Is there a fix for this that leaves the camera in the centre?
Answer by DroidifyDevs · Jun 04, 2016 at 10:04 PM
This is complex. Try overlapping the rows to try to cover up the lines.
You can try submitting a Unity bug and explain that the ugly lines show in the tutorial as well.
Sure, for now I'll just move the camera 1% of a unit and increase the size so the border round the board is big enough so's you don't notice
Answer by Mackx · Feb 01, 2017 at 11:36 AM
Hope this still comes in handy.
As opposed to changing the tileposition to overlap for visual effects, which I thought would cause problems in calculating positions, I instead took the Main Camera and set its rotation-X-value to 0.1
This clears the black lines but leaves the grid perfectly aligned, without visible impact on the position of the camera.
Initial setup
This is the MainCamera setup as instructed in the tutorial. you can see the black lines in the gaps between tiles. NOTE: the scale of the screen actually also affects where the lines can be seen.
After camera rotation
Here the camera is rotated. The blacklines disappear in all scales and there is insignificantly little impact on the camera.
Answer by Aedict · Mar 29, 2018 at 01:19 PM
This didn't work for me, but what did was altering the aspect ratio of the game window from free aspect to 16:9 which is that of my monitor.
Answer by AstarothAst · Mar 23, 2019 at 09:40 AM
,Set 'Filter Mode' to 'no filter'