The Unity engine is incredibly flexible for all the aspects of game development, including creating custom editor tools to help fast track the more tedious aspects of development. In our case, it will be beneficial to have a tool that creates a root GameObject that will then create children GameObjects in a grid. The grid will be spaced out by the size of the sprite component that each of the children GameObject is using.
For example, if you were to place say 24 GameObjects one at a time, it could take some time to make sure that all are snapped correctly together. With our tool, we will be able to select the X
value and the Y
value for the grid, the sprite that represents the ground, and the sprite that represents the dirt below the ground. Perform the following steps:
To begin with, navigate to the
Assets
folder. Right-click on this folder and select Create and then New Folder. Name this folderLevel
.Right-click on the new
Level
folder and select Import...