Game Development Reference
In-Depth Information
Note the wasted space on the texture sheet. To conserve memory, you can atlas different sprites
together on the same sheet, as you will see in the Bundle asset, or, if you have Unity Pro, you can
make use of its Sprite Packer option from the Edit menu, Project Settings, Editor section. The
Sprite Packer will internally pack your sprites for optimal memory usage. The sprite's Packing
Tag parameter determines which sprites can be grouped together for more efficient use of space/
memory. Only similar texture sheets should be atlased (e.g., those that use different compression or
alpha channels).
6.
Click Apply, and close the Sprite Editor.
7.
In the Project view, click to expand the Stork asset.
8.
Just as with the Battery, it now shows the newly generated sprites (Figure 9-29 ).
Figure 9-29. Stork sprites in the Single Column Layout and the Two Column Layout
To create an animation, you will drag the sprites you want into the Scene view. This will automatically
create an animation clip, add an Animator component, and create a state for the clip.
1.
Select the Stork sprites 0-6, and drag them into the Scene view.
2.
At the Create New Animation window, name the clip, Stork_Fly and put it in
the Animation Clips folder.
3.
Assign the new Stork_0 object to the Sprite layer.
4.
Click Play to see the animated sprite.
The animation happens as soon as you click Play because of the clip's state that was created for the
Animator component. You can adjust the clip's speed from the Animator view, just as with any other
Mecanim-driven animation.
5.
Open the Animator view from the tab or from the Window menu.
6.
Select the Stork_Fly state, and set its Speed to 2 .
7.
Click Play, and watch the double-time play speed.
8.
Set the Speed to 0.5 to see a slower playback.
9.
Set the Speed to back to 1 .
 
Search WWH ::




Custom Search