A lot of types of games (building, simulation, strategy for example) use a virtual grid system. Today I’m going to show you, how to move objects on a virtual grid. As before, I have uploaded all my files free for you to use.
So this is what my game view looks like for this tutorial. The “ground” is a default unity plane (Scaled 1 x 1 x 1) for which I created a small texture to represent one grid “box” and set the material tiling to 10 x 10 so the total plane would be a virtual grid of 10 by 10. The ground also has it’s tag set to “ground” to contain the movable cubes in this specific area.
The cubes are just 2 default cubes with different colored materials attached to them.
The only script, GridMoving.cs, used in this tutorial, is attached to the Main Camera.
Download GridMoving.cs
Download Grid.png
Moving notice:
Minor edit to post.
1 comment