Tile Tear in Unity
Can anyone help me with this please ? Here how the tear happen and the screenshots of Camera's properties and script below.
I used Tiled and Tiled2Unity software by following this tutorial > Unity RPG Tutorial - Learn to make an RPG game & learn C#!
Answer by eses · Aug 17, 2018 at 10:57 AM
Hi @ElaxomoeR
First of all, you are not moving in pixel increments.
What you need to do, is do some reading on "pixel perfect camera movement" in unity, and in general as technique for retro / pixel games. There are many articles, blog posts, even premade assets.
There is nothing preventing your camera from moving freely as you have chosen to move using deltaTime, imagine your camera sliding in increments smaller than pixel each frame... you are not moving in steps so that you'd move distance that matches pixel's width/height.
Also, camera can't (possibly) be at any distance away for tilemap, consider this, you have 2x2 pixel map, if you back away so that you see 2.5x2.5 pixel area in your camera viewport, is it pixel perfect? Same goes for movement in x an y directions.
The "gaps" might be caused by several things.
I suspect that you haven't read this Tiled2Unity manual page: https://tiled2unity.readthedocs.io/en/latest/fixing-seams/
I've never used Tiled2Unity, but I've read about it. IIRC it creates a textured mesh, and it should be seamless.
Also, "gaps" might be due pixel bleeding / textured polygons / mipmaps. This is not related to Tiled2Unity or Unity, it goes for any 3D rendering system that uses textured polygons. You can minimize this by removing texture filtering in your texture, but it probably won't fix this completely, see Tiled2Unity page.
In this case, I have no idea what you have done, so it might be a tiny seam between polygons, that shows up only when camera moves at certain fractional position and ends up so that the gap shows, or it might be just texture bleeding.
Thanks @eses I am just begin the study 2D and I am lost out there. I will read around what you said and thank a lot again for answering my question.
Answer by slkjdfv · Jun 17, 2020 at 11:54 PM
@ElaxomoeR This will fix your issue.
It's a tool I made that eliminates tearing by stretching out the edges of your tile set. Using pixel perfect cameras doesn't always fix the issue and you can still get tearing.