Separating Animations

From ETC Public Wiki
Revision as of 14:28, 25 April 2011 by Waikayk (talk) (Separating Animations inside of Unity)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There are two ways to deal with animations in Unity:

  1. Export one large file that includes all of the animations and separate them inside of Unity.
  2. Export one dedicated model file and a series of animation files using the @ naming scheme.

Information may be found here: http://unity3d.com/support/documentation/Manual/Animations.html#ImportSplit


Separating Animations inside of Unity

Importing models and animations as one large file actually keeps the overall file size smaller. Exporting many separate files can be heavy on space usage.

  1. Drag the one large file into Unity's Project Panel.
  2. Select the model to open it in the Inspector.
  3. Select the model to open it in the Inspector.
  4. Check the Split Animations checkbox.
  5. Directly underneath, there should be an empty table that says "Name|Star|End|WrapMode|Loop." Click on the little circle with a plus sign in it (See Figure 1). File:Animations1.jpg
  6. A row should be added named "idle" with start value 1 and end value 25. Click on the name to modify it how you wish. Same with the Start and End Value. These numbers correspond to the Start Frame and the End Frame of the animation. Unity will automatically sample the animation at whatever framerate your Modeling package is set to, so these numbers should be the exact same as what you keyed them as.
  7. WrapMode will dictate how your animation will play. Go here for a more detailed explanation on WrapMode: http://unity3d.com/support/documentation/ScriptReference/WrapMode.html
  8. Click on the circle with the plus sign again to add another animation clip. Do this as many times as you wish.
  9. Your programmer should be able to access these animations by script.

The @ Naming Method

Animations can be split outside of Unity as well by exporting separate files for the model and each animation. The advantage of this is that each animation is completely separate from the other animations. Should you want to modify, lengthen or shorten a specific animation, it will not affect any of the other animations.

  1. Save a file to serve as the "model" file. Either export as an FBX or as the native modeling package's file format. Note: Make sure the native file format is Unity Supported. Go here to see Modeling Packages supported by Unity: http://unity3d.com/support/documentation/Manual/HOWTO-importObject.html
  2. For the first animation, set the animation start and end frames and save another file. This time, use the naming convention modelname@animationname. For example, say the model is named person, then the animation is named person@walk.
  3. Repeat step 2 for every animation.
  4. Import all the files into Unity via the Project Panel.
  5. Unity will automatically detect and link models and animation files that are named this way. e.g. Unity will find the @ symbol in person@walk, search for a model file named person and assign an animation named walk onto it.
  6. Your programmer should be able to access the animations by script.