Game Development Reference
In-Depth Information
Setting up animation clips
Unlike the 3D system in Unity where animations are defined in modeling programs and
bound to certain model types and poses, there are actually two ways in which animations
(or clips) can be created in the new 2D system. This is because Unity controls the creation
of an animation, not an external tool.
Manual animation clip creation
Let's start off by creating some animation clips manually. It is a slightly lengthier task
than the manual route, but it is good to understand what the automatic system is actually
doing for you. This helps you choose which route to take depending on the kind of anima-
tion you want to create.
To start, first we need to create a game object in the hierarchy with an animator compon-
ent and controller attached to it so that we can add a reference to the spritesheet. Perform
the following steps:
1. Drag either the spritesheet (with the regions defined) or any single sprite to the
scene hierarchy in the scene view. This will create a new game object with Sprite
Renderer for the assigned texture.
2. Add the Animator component to the game object.
3. Create a new animator controller by clicking on Animator Controller in the Pro-
ject view.
4. Drag the new animation controller to the game object, or set it to the Controller
property in the inspector panel for the animator.
Now, if you open the Animator window ( Window | Animation ) with the new game ob-
ject selected, you will get a blank animation with no clips defined, as shown in the follow-
ing screenshot:
Search WWH ::




Custom Search