Best way to handle tiles

My project is based on tiles - each has the same geometry but a different texture. What is the best way to handle this?

a) One prefab, load/switch texture in code
b) A prefab for each tile
c) Other?

Approach “A” is the most efficient, but instead of assigning a unique texture for each tile put all textures into a single texture sheet and offset the UVs for each tile using Mesh.uv. This way all the tiles will use a single material and can be batched together into one draw call in Unity 3 or Unity iPhone.

Ah I see. A texture atlas?

I’ve never tried to do anything tile-based in Unity, but I can imagine that having each tile be its own game object with its own transform could lead to ‘sparklies’ or other visual artifacts where the tiles meet. (I’m not saying this would happen; just that it just seems like it could happen.)

In any case, if I were making a tile-based game, I’d probably create the tile meshes manually and express them in world space to ensure that the edges matched up correctly. (And yes, I’d probably use one or more texture atlases as well.)

Well, yes my game is tile based, but not in the normal way - i.e. it is not a 2D tile-based game. It is a game involving physical tiles (like pieces on a game board) :slight_smile:

I was looking at tiles for terrain, and you’ll get problems at the edges of each tile if it’s a separate object or the edges are unconnected in any way. The only way to hide the problem would be to keep each tile completely flat, not use any realtime lighting and have no specular effect on the surface.

Supposedly doing something with the normals that no other package seems to be able to do can fix it, but nobody knows how.

I would suggest using the sprite libraries if you are doing some sort of 2d tile game. Though i don’t think it is designed for any form of lighting or anything like that.