
Unity 4.x Game Development by Example: Beginner's Guide
By :

Now that we have one working Square
, let's create eight more to fill in the remaining gaps. But before we do that, we should encapsulate the Square
in a Prefab, so that any duplicates will share the changes we make.
Create a Prefab and rename it Square
.
Drag the Square
GameObject from the Hirearchy panel inside the Square
Prefab in the Project panel. The Prefab lights up that familiar shade of blue.
In the Scene view, duplicate the first square until you have a total of 9 squares in the grid gaps. An easy way to do this is to duplicate the top-left square twice, and drag the copies to the top-middle and top-right spaces to complete the first row. Then select all 3 squares and duplicate them. Move the three duplicates down to the middle row. Duplicate again, and move the last three squares to the bottom row.
Click on each square and, in the Inspector panel, its x
and y
values appropriately. When the value is bold, that means it's overriding the Prefab's default value of 9
...
Change the font size
Change margin width
Change background colour