Game Development Reference
In-Depth Information
Extra credit
We have a nice run and stand animation, but wouldn't it be better if our hero had a spring
in his step? So let's extend our running animation, and also highlight one of the pitfalls of
doing so and how to fix it by performing the following steps:
1. Select the Player game object, open the Animation window, and select the
CharacterRun animation clip.
2. Click on the middle keyframe in the animation.
3. In the Inspector pane, change the Y Transform value to 0.1 .
This will update your animation as follows:
However, when you now run your project and make the hero run around, you will see the
hero doing his new run animation and bobbing up and down as expected. However, it will
soon stop moving; what the heck? The reason is simple; by setting the Y property of the
game objects in the Transform pane, you also have to set the X and Z properties to 0 be-
cause they are all part of the Transform pane's Vector3 property. This may be changed in
future versions of Unity. However, currently, it isn't possible to just animate a single prop-
erty of constructs, such as vectors or other complex types.
There is a workaround, which is more on the lines of how you should create complex
game objects that have many parts. Just split Character from the rendering of its sprite by
performing the following steps:
Search WWH ::




Custom Search