- Home /
Animation from a Blender model not looping
I am following Sebastian Lague's fantastic Unity 2D platformer tutorial (http://www.youtube.com/watch?v=_4HPI6ZopB8).
I have an issue when I import the model (https://copy.com/Q4IDiTqsKBn7Pu1Z/Player.blend?download=1) given with the tutorial into Unity 4.3.4f1. The animations do not cycle they just show the leg raising and getting stuck. When I look inside the model file in Unity and look at each animation I see that Loop Time and Loop Pose are not checked and are greyed out so cannot be changed.
If I open the full Unity project directory provided with the tutorial (https://copy.com/xWfjLmRW8GCFRMFk/Part%203?download=1), the Loop Time and Loop Pose checkboxes are checked. In this version the animations do loop.
Looking inside the player.blend.meta files for the two versions, I can see that in my version there is the line:
clipAnimations: []
Whereas in the working version this is replaced by:
clipAnimations:
- serializedVersion: 16
name: Default Take
takeName: Default Take
firstFrame: 0
lastFrame: 81
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 0
loopBlend: 0
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: Headband_Wave
takeName: Headband_Wave
firstFrame: 0
lastFrame: 10
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 1
loopBlend: 1
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: Idle
takeName: Idle
firstFrame: 0
lastFrame: 1
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 1
loopBlend: 1
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: Run
takeName: Run
firstFrame: 0
lastFrame: 15
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 1
loopBlend: 1
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 0
maskSource: {instanceID: 0}
- serializedVersion: 16
name: Walk
takeName: Walk
firstFrame: 0
lastFrame: 18
wrapMode: 0
orientationOffsetY: 0
level: 0
cycleOffset: 0
loop: 0
loopTime: 1
loopBlend: 1
loopBlendOrientation: 0
loopBlendPositionY: 0
loopBlendPositionXZ: 0
keepOriginalOrientation: 0
keepOriginalPositionY: 1
keepOriginalPositionXZ: 0
heightFromFeet: 0
mirror: 0
bodyMask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
curves: []
events: []
transformMask: []
maskType: 0
maskSource: {instanceID: 0}
Copying and pasting this code into my version makes the animations run. However, I am worried about encountering this problem with my own Blender files and animations. How can I make the imported animations Loop Time and Loop Pose turn on? Alternatively, can I force Unity to expand the Clip Animations section so that I could edit these two settings (ie. change from 0 to 1) in the meta file?
Answer by OllyNicholson · Mar 04, 2014 at 02:34 PM
Since the introduction of Mecanim (4.x) you edit your clip properties on the Animations tab of the model file, so it sounds like you may just need to set up your rig and animation clips first:
In the Project pane select the imported blender/fbx file (NOT the clip below it)
Go to the inspector: and in the rig tab - select Generic or Humanoid (if you want to retarget)
Go to the animations tab: Select each clip and Loop time / loop pose as
applicable
For more information check out the documentation for the Mecanim animation system:
http://docs.unity3d.com/Documentation/Manual/MecanimAnimationSystem.html http://docs.unity3d.com/Documentation/Components/class-AnimationClip.html
I had tried this and it didn't work. Now I see why. When I make the change, it brings up a dialog box that says "Unapplied import settings". I had not put two and two together and kept closing the dialog box as it didn't make any sense to me. If I accept, it now works. Thanks.
Wow! I read tens of answers , only to find this correct one.. I created an account on this website just to upvote this answer haha. Thanks a lot!