Game Development Reference
In-Depth Information
The ToastedZombie animation loops when it should be a one-off. Also, you may be wondering why it
is playing at all. The mystery is quickly solved.
1.
Stop Play mode.
2.
Open the Animation Clips folder in the Project view.
Inside it you can see the Jump Shrink clip you created, but a ToastedZombie Animator controller
was automatically generated at the same time as the clip!
3.
Double-click to see what is in the newly created Animator Controller.
It is no surprise that it is a state for the Jump Shrink clip.
4.
Select the Jump Shrink clip.
5.
In the Inspector, uncheck Loop Time.
Now is a good time to make sure the object can be moved in the scene with no ill effects.
6.
Move the Toasted Zombie Parent to a different location in the scene.
7.
Click Play.
The ToastedZombie animates correctly from its parent's new location.
8.
Drag the Toasted Zombie Parent (or Burnt Alien Parent) from the Hierarchy
view into the Prefabs' Characters folder.
9.
Save the scene, and save the project.
You will finish setting up the functionality on the characters later in the topic, but you should now
have the beginnings of your game off to a good start.
Summary
In this chapter, along with an odd assortment of imported characters, you got your first peek at the
game's premise. Invaded by voracious zombie bunnies, your mission will be to eradicate the threat
with the help of a repurposed garden gnome statuette. Among the cast of characters, you got to
explore setting up several different animation types.
You began with Legacy animation, the Rig type that works well with mechanical animation where the
object is only asked to animate occasionally. Using the OnTriggerEnter code you learned in Chapter 5,
you set up a set of sensor-activated garden gates. Legacy, you discovered, has an option to Play
Automatically on start-up. You got your first experience with setting up animation clips when the
animation comes in as a single “take.” Using frames to specify individual clips, you learned that Unity
acknowledges the frames per second used when the animation was created. While there was no
particular naming conventions for animation clips, you did learn that it was important to give clips unique
names that identified their source. With the clips in place, you added two simple animation.Play lines
to the script to trigger the appropriate clips. Audio, you discovered, was even easier to add with
audio.Play for sound effects.
 
Search WWH ::




Custom Search