Game Development Reference
In-Depth Information
Starting the Enemy Drone Prefab
First, create a new and empty GameObject in the scene (named Drone ), to represent the basis
for the Drone enemy character. As seen before, new objects are created with the shortcut key
Ctrl+Shift+N , or by selecting GameObject Create Empty from the menu. Often, however, the
new object is not centered at the world origin as you'd expect, but is positioned at an offset. Now,
this isn't really problematic, because it's easy to reset an object's position by simply typing in 0, 0, 0
into the X, Y, and Z fields of the Transform component in the Object Inspector. But, there's an even
quicker method still. Just click the Cog icon in the Transform component, and choose Reset from the
context menu, to reset the Transform component to its default values (see Figure 7-4 ).
Figure 7-4. A game object can be reset to zeroed values by choosing Reset from the component cog menu
Next, drag and drop all Drone-related sprites from the atlas texture in the project panel onto the
newly created empty in the scene, ensuring all sprite instances are added as child objects. Be sure
to drag and drop the sprites into the Hierarchy panel, and not the Scene viewport. Remember,
the hierarchical arrangement of objects in this way (many objects grouped as children beneath a
common parent) is crucial for easily generating Prefab objects further along the line. Prefabs expect
a single parent ancestor (see Figure 7-5 ).
 
Search WWH ::




Custom Search