MeshCreationGrid

The below script generates a mesh for use in a tile based game. In order to utilize it simply attach it t a gameobject, populate the public variables, and hit play. You should be greeted with a grid of the size you chose with randomly changing tiles.

Make sure that under the properties of your Texture you have FilterMode: Point and WrapMode: Clamp otherwise you will see artifacts as you move the map around. Also ensure that your texture is Power of 2 height and width.. 256x256, 512x512, 512x256, 1024x512 etc..

In order for this to actually be useful you will need to write the logic that calls UpdateGrid elsewhere in your code to render your level.. And obviously turn off the code in Update that randomly sets tiles. :)

There is a unitypackage attached to the forum thread linked here; it shows an example modification of the code below to load a simple level file from resource and draw it to the grid.