Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity3D: Strange 1 pix white line between tiles on my 2D game

My game have a tiled 2d map. This is a scene screenshot: enter image description here

I found when I move the camera vertically, there are strange white lines randomly appeared between randomly tiles, See: enter image description here

I don't know why....

PS: This is a pixel style 2d game, so my texture's filter mode is "Point".

PS: I uploaded this test scene at https://dl.dropbox.com/u/53858613/Web/Web.html , Hold the left mouse button , camera will move downwards, then you'll see white lines randomly.

like image 724
Zephyr Zhang Avatar asked Oct 05 '22 16:10

Zephyr Zhang


People also ask

Why are there lines in my Tilemap?

You'll notice long, weirdly colored lines appearing vertically (as I've seen it) on your tilemap. According to what I've been able to tell this comes from your camera not snapping to a whole number pixel count, which seems to be the issue in my case.

What is Tilemap in unity?

The Tilemap component is a system which stores and handles Tile Assets for creating 2D levels. It transfers the required information from the Tiles placed on it to other related components such as the Tilemap Renderer and the Tilemap Collider 2D.


2 Answers

Change your materials shader to something more suited for 2D. Such as sprite/default.

I made a quick test project and changing the shader from "diffuse" to "sprite/default" solved the issue.

like image 115
JohnD Avatar answered Oct 12 '22 16:10

JohnD


What fixed it for me is setting the compression for my 2D spritesheet to point instead of bi-linear

like image 20
Spekachu Avatar answered Oct 12 '22 16:10

Spekachu