- Home /
How can I overlay an image across multiple game objects?
I currently have a grid of tiles serving as a map, which my other game objects traverse over. What I would like to do is be able to apply a single image over the tiles to give it a seamless appearance while still keeping the functionality of the tiles.
What would be the best approach to try and add this?
I am not sure I know what you mean. I built a tile map in Unity2D out of individual tiles and it worked fine. if you are seeing gapping between tiles then your tiles are either not placed or not sized correctly.
You can make a single image out of them at runtime with Unity Pro by using RenderImage and Graphics.Blit. But its not going to make any difference....
Answer by MakeCodeNow · May 23, 2014 at 11:06 PM
You'll need to compute the UVs for each of your tile vertices. This should be pretty simple. Just look up the math for "planar mapping" and check out the Mesh script docs to see how to apply new UVs to a mesh.
Yes. Basically, if you have 2x2 tiles:
tile1 tile2
tile3 tile4
the uvs would be:
tile1: (0,1) (0.5,1) (0.5,0.5) (0,0.5)
tile2: (0.5,1) (1,1) (1,0.5) (0.5,0.5)
tile3: (0,0.5) (0.5,0.5) (0.5,0) (0,0)
tile4: (0.5,0.5) (1,0.5) (1,0.5) (0.5,0)