I’m new to Unity and Tiled in a whole. I’ve successfully exported a map into unity, all’s dandy, but i’m trying to make a night scene so i’d need lighting.
I’ve read somewhere that you need to add a material with a Sprite/Diffuse shader, but I have absolutely no clue where to exactly add it. I have a few layers on the map, but haven’t found the right component to add the material to. It either screws up the tile or doesn’t work.
Hi Alon, this is a better question for the Unity forums but you you won’t be adding a material, instead you will edit the material on the layer(s) on the prefab to use the shader of your choice.
Problem is, when i change the material that comes with Tiled2Unity, the tiles don’t snap and I get this very weird artifact of black lines showing on the tile borders. So ultimately, I have to choose between the two.
I hope you have an insight about this and could shed some light about what to do with it.
Yes, those seams you are getting a common in Unity for some reason when you are using lighting. Very annoying.
The very best to combat that is to re-author your tiles in this kind of way (assuming you have 32x32 pixel tiles):
Make each tile 34x34 instead (adding a row/column of pixels to each side)
Have the top row of pixels the same as the pixels that come below it (on the source tile)
Have the bottom row of pixels the same as the pixels above it
Have the left column of pixels the same as those on the right
Have the right column of pixels the same as those on the left
Change your tileset properties so that there is a margin of 1 pixel around each tile. (This way, your tiles are still 32x32 in the tileset, but 34x34 in the texture)
What you are doing here is making up for the Unity texture sampler going out of bounds due to mathematical precision errors. In this case, should the texture sampler pick a texel “just outside” your tile then it will end up picking the same pixel that comes before it – if that makes sense. (If you look up “seams” and “texture sampling” on the internets you’ll get a better explanation.)
If you have a lot of tiles on a texture you can use a GIMP pluging called Gutter that should automate the process of adding a pixel boundary around each tile.
this post might be old and your problem seems to already have been solved but after I fixed the material and got those lines in-between each tile, I fixed that by going to Edit>Project Settings>Quality, and turning anti-aliasing off, I’m not sure if this process is easier than the GIMP process but this one works for me and I can’t really see a drop in quality. GamesPlusJames (youtube) taught me that.