Using Grid Snapping to Position GameObjects

Last, we can precisely position a GameObject by using the grid snap option. This takes the pivot point of the sprite as the position from which it snaps to place it exactly where you intend. You can do this with multiple selected tile sprites as well.

1. Select both the grassMid and grassCenter GameObjects.

2. Duplicate the GameObjects by tapping Ctrl + D. Notice that you now have two of each object in the Hierarchy window.

3. Select one of the grassMid and one of the grassCenter Prefabs from the Hierarchy window.

4. Hold Ctrl and left-click and drag the tiles one snapped unit to the right in the Scene View. You will now have four sprites to make up the first part of our ground-floor tiles.

5. Continue ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.