Game Development Reference
In-Depth Information
Duplicating GameObjects
In Unity, you can use Ctrl +D ( z + D on Mac) to duplicate objects. Some items—such as materials,
textures, scripts, and many others—must have unique names and will automatically be incremented
upon duplication. GameObjects, however, can share names, as you may have noticed with the
AngryBots game. If you think you will need to access an object as an individual, you should give it a
unique name.
In this section, you will name the duplicates for easier identification after clearing the Sphere from
the Scene view.
1.
Select the Sphere in the Hierarchy view.
2.
At the top of the Inspector, to the left of its name, uncheck the check box to
deactivate the Sphere in the Scene view.
The Sphere disappears from the Scene view, but its transform gizmo remains visible as long as it is
selected.
3.
Click in an empty spot in either the Scene or Hierarchy view to deselect the
deactivated Sphere.
In the Hierarchy view, the deactivated Sphere's name is grayed out (Figure 2-9 ).
Figure 2-9. The deactivated Sphere in the Hierarchy view
4.
Select the cube from either the Scene view or the Hierarchy view.
5.
From the right-click menu, select Duplicate.
6.
Rename the clone, Cube1 .
7.
Pull Cube1 away from Cube so they are at least a meter (the original size of
the cubes) apart.
8.
With either cube selected, press Ctrl +D (Command + D on Mac) to clone
another cube.
9.
Rename the new cube, Cube2 .
In case you can't tell which is which, it doesn't matter at this point, though the one selected should
be the new one.
10.
Move Cube2 away from the other two.
 
Search WWH ::




Custom Search