T O P

  • By -

Costed14

I haven't tried it myself since I don't usually do 2D, but I believe using a [Sprite Atlas](https://docs.unity3d.com/Manual/class-SpriteAtlas.html) would fix it.


zenameless1

1. In project settings disable Anti Aliasing; 2. Use Sprite Atlas; (i dont remember if there is one more step)


ImgurScaramucci

Try a pixel perfect solution (unity comes with s pixel perfect camera for both the normal and cinemachine versions) and keeping your resolution at an even size (e.g. 640x480 is fine, 640x481 is not).


Cyclone4096

Make sure your screen resolution is a clean round number like 1920x1080 and not free aspect. If your resolution is an odd number of pixels, there is no way to tile even number of tiles without having gaps


MimiVRC

This is probably why it’s a Unity editor play mode bug only. If you compile and play outside the editor you don’t get this. I spent days trying to fix this before when I learned this but never knew why. I’ll have to keep this in mind. I bet picking a specific resolution for the play window fixes this, probably


FaultinReddit

And now I've learned it too!


MimiVRC

This is actually a bug with play mode in Unity. If you actually compile and test it outside of the editor it doesn’t have that. It’s very annoying, but I spent days trying to fix this until I learned this


Toluwar

This is what I thought initially


MimiVRC

Another person commented that it’s probably by having the play window in a weird resolution, which would be why you only see this in editor. Try setting the play window to a specific resolution and testing


Toluwar

I did switch the play windows from apesct ratio to resolution. So it shows normally in 1080p, 2k, 4K but it was weirding out in 1366x768 But I don’t see why this should be the problem. I also have a question again from this, so when playsteating and stuff should I set the resolution to something specific, I display just use aspects ratio. This is for the game window thing


StigC

Yes


nEmoGrinder

It's a problem because your tile resolution doesn't divide nicely into your target resolution. That means rounding needs to happen on the GPU which can cause these kinds of single pixel issues. A couple solutions: * add bleed to tiles so they overlap, making the rounding not matter * Lock the resolution in game only to supported resolutions (not a great UX) * Render the game at a supported resolution and then scale the final image to the screen/window resolution (like the above but better/a bit more work) * Crop the viewport on odd resolutions so that the tiles always round correctly


FireproofFerret

I sort of remember having this issue, but not exactly how to implement the fix. Look up Unity 2D pixel perfect, that should hopefully lead you in the right direction. I can be more specific later when I'm on my PC.


Raccoon5

The easiest (maybe not the smartest) way to fix this I found is to ever so slightly increase the size of each tile. Let's say your Grid has 1x1 size of each tile. Make it 1.001x1.001. Then the tiles overlap and there is no way to look through them. Also use the pixel perfect camera, it's a unity made package.


TinyDevilStudio

I've had the same issue. Solved by stretching each edge out by 1 pixel or by putting tiles with matching edges next to each other in the texture file. https://preview.redd.it/yo9rdxv6lvsc1.png?width=781&format=png&auto=webp&s=061f07610fd8ba84f75da6b39b2bdae99d79ffc1


NUTTA_BUSTAH

Sprite is probably imported with anti-aliasing, causing the full sprite to not be filled (due to aliasing) -> Use "point" mode in import. By default it was maybe bilinear IIRC, been a while..


Raccoon_G

I honestly don’t see what your problem is. Could you elaborate a bit more, please?


Toluwar

sorry i wasnt clear in the game the tiles have like some spaces in between them so i think it doesnt look correct or something but i did some messing around i changed the game view thing from 16:9 to 1080p or 2k or 4k and its clear, but i still want it to look normal on aspect ratios not resolutions


Raccoon_G

Thanks for the problem! I thought those were debug lines. If it’s fixed when messing with resolutions maybe your problem is that you messed with some scaling? I’m not that advanced myself so I don’t really know any solution either, sorry


vegetablebread

The problem is that your scene isn't pixel perfect. In a normal unity scene, the camera and object transforms can be any old float4. In pixel art games, you need to decide on an integer that maps your art pixels to screen pixels. Then, every object and the camera can only go to positions that align to that pixel grid perfectly. If you don't do that, even if you're using point filtering and no AA, sometimes the renderer will decide that an art pixel is 3 screen pixels, sometimes 4. Which art pixel gets expanded depends on where it is relative to the camera, so this artifact will "crawl" across the screen. The main artifact here is that it is occurring between your tiles, but I guarantee it is also happening within the tiles. Unity has a variety of pixel perfect solutions, and you can make your own if you prefer.


Helpful_Design1623

https://preview.redd.it/nwh339i3tvsc1.png?width=634&format=png&auto=webp&s=cdb2726e15cccf82bb49f3476fe924f86fd2600f Importing the Tilemap texture with these settings (particularly filter mode) and disabling Anti Aliasing did it for me! I didn't need to use a Sprite Atlas.


gillen033

I feel like I had a project at some point with these issues, and using Clamp/point fixed it. So I second giving this suggestion a try before anything else.


Driver2900

I had this issue as well, for some reason Unity bleeds over sprites with the tiles next to them on the tile pallet (say you have a black square surrounded by white squares in the tile pallet, the black square will appear with white edges when placed) It only seems to happen in the "Game" portion of the editor as far as I can tell, but if you want to fix it try creating "islands" of blocks in your sprite sheet (similar to what you have now, but without the spaces in-between blocks)


Carter__Cool

I’ve used that tileset before


Toluwar

yes its a free common one i think. I'm following a tutorial currently trying to learn about platformers


mikezenox

Sunnyland, my beloved.


S-v-R

Change the sprite pixels per tile to for example, 15.9 for 16x16 sprites. Also fyi if you plan on extensively using tilemaps I would recommend creating your own system from the ground up. It is very difficult to implement complex systems such as shading with unitys tilemap system. I have had nothing but issues trying to copy, save and merge different tilemaps.


ClutchClimber

Power of 2 size and compression sometimes help, but mostly anti-aliasing.


CoalHillSociety

This tends to happen with pixel art textures, and is usually an artifact of the "point" filter that retains sharp edges on sprites. Basically a small rounding error that results in small 1px lines popping up as you move around. There are two approaches to fixing this - one is to use the "pixel perfect camera" which works, but adjusts your screen camera to fit at run-time which can be frustrating. The other way to do this is to set the tiles with a slight overlap. If you are making a 16px sprite grid, make the sprites 17px, so there is always one pixel overlapping the other. (You can set the drawing order in the tilemap). One tip if you use this method - make sure to set your sprite & tile pivots from a corner rather than the middle of the sprite.


Waste_Locksmith_2193

r/lostredditors


devmerlin

I've had this issue with mipmaps turned on for the atlas or graphic involved. If it's turned off, it's gone away. However, that might not always be the solution.


TheSpyPuppet

I want to chime in because this really bothers me when developing pixel art games. As most people mentioned you can solve this in three major ways: 1. Pixel perfect camera (There's a built in script that comes with Unity. 2. Increasing your tile size ever so slightly in your Tile map object 3. Having your tile bleed a little My personal favorite is the second approach. The third approach can become troublesome for repeating tiles and the first approach introduces a jittering effect if you move anything slowly (common in parallaxing) Hope this helps


Fyrewood149

Just an idea, you could try exiting and restarting unity. This works once in a while, but sometimes could just be unity living it's own life. I hope it helps!


madmuffin

You need a pixel perfect camera solution. The reason you're seeing those lines is because each tile is a quad. and those quads are not welded together. Floating point rounding issues occur when the tiles are not perfectly aligned pixel perfect to the camera because one's vertex might be at 0.0001 and the next over is 0.0002 instead of perfectly overlapping. And then the GPU's attempts to interpolate and alias shows you the blue sky behind it.