This example shows how you can map an Image to a grid using a grid builder. Grids already has an example showing how to do this in code. This example shows how to make a grid behaviour so that you can use it with a grid builder in the editor. This example uses a modified UVCell (which will be shipped with Grids 1.10).
The example usesa custom GridBehaviour that is attached to each grid. This behaviour creates a new UVImageMap (very similar to ImageMap) that is used to set up the UV offsets and scale for each cell. There are three modes Stretch, StretchWidth and StretchHeight. The last two preserve the aspect ratio.
(Requires Grids 1.9 or Hex Grids 1.9)
- Import Grids in a new project.
- Import the package below in a new project.
- Open the example AdditionalExamples/ImageMapInEditor/ImageMapTest.