- Home /
Unity 4.3.3 Animation AddClip length is always 1 Second
When adding animations to a model in code using animations AddClip the animations created are always 1 second long. When played, when viewed in the inspector but not when created. It works currently under 4.2.2 but not under 4.3.3 ( or any 4.3 version ). The animation still works but simply only lasts one second. Have looked on the answers and forums but cant find a solution and no posts seem to be recent.
We use this for all our animations and would rather not use the inspector to add all our clips so finding a solution for this would be ideal.
Code:
cachedAnimation.AddClip(cachedAnimation.clip, animationName, startFrame, endFrame);
If you want to reproduce it just... 1. Import a model with a single take 2. Create a clip using add clip 3. Play the animation using animation.Play(...) 4. Make sure the model is using legacy mode and not mecanim
This was listed as fixed for Unity 4.5: http://unity3d.com/unity/whats-new/unity-4.5 "Fixed AnimationClip.Length always returning 1 for all player."
(Oddly, it's listed under "$$anonymous$$ecanim Fixes", but this bug applies to Legacy Animation system as well)
Unfortunately, the bug exists in the latest version of Unity 4.6, and when using Legacy Animation system, after adding a clip as described above, the clip length will always play for only one second, and the inspector will show the clip as being only 1 second long. Either the fix was never carried over into the 4.6.x releases, or the bug was never actually fixed in the first place.
Please rectify this soon in Unity 4.6! I haven't tested 5.x but I wouldn't be surprised if the bug exists there as well, so please fix it there if it does.
Thanks.
Just found this post after one hour of debugging... Yeah, please fix this. Is there any workaround?
Your answer
![](https://koobas.hobune.stream/wayback/20220613131945im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 4.3 - Won't Build in Xcode : __curOrientation 3 Answers
Concurrent Animations using an Animator? 0 Answers
Importing blend shape animations from Blender 2 Answers
What has changed in the WWW class? What am I doing wrong? 0 Answers
Movement on all projects/games are moving on their own. 0 Answers