Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by adrianward · May 09, 2012 at 02:03 PM · animationtimelineloopingkeyframecurves

How to set the duration of a looping animation from the inspector?

Hopefully this is just a newbie question, but I can't seem to see where Unity defines the duration of an animation. It always seems to be a little way after the last keyframe, and rather infuriatingly, even just moving the playhead to a position after the last keyframe extends the animation even further.

I'm trying to make a simple looping spinning cube - nothing difficult. I've set my Wrap Mode to Loop. I've added a curve for Rotation.x, I've set up only two keyframes, f0 = 0° and f60 = 90°. Now this is what I see when I zoom out on my Animation inspector:

alt text

Now, can anyone explain

1) where did Unity decide to set the length of my loop to (approx) 58:00 and how do I change that? You'll see there are no other keyframes on any of the timeline objects

2) why, when I move my playhead further right than 58:00 (ish), that extended flat line goes even further - but I can never get it to reduce the length of the animation? Argh!

3) how can I reduce the length of my animation to be 1:00 (i.e., 60 frames) so that my rotating cube looks seamless?

I'm sure I'm overlooking some minor detail. Please enlighten me!

UnityAnimationLoopingIssue.png (32.5 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adrianward · May 09, 2012 at 05:10 PM 0
Share

I've just spotted this almost identical question:

http://answers.unity3d.com/questions/240937/why-is-unity-adding-extra-frames-to-animation.html

For the record, I am also on $$anonymous$$ac OS X (10.7.3, 11D50b), but running Unity 3.5.1f2, and I consider this to be a Unity bug.

5 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Steven-1 · Jul 27, 2012 at 09:22 PM

Had the same problem, found this in the support forums: http://forum.unity3d.com/threads/131340-Reduce-animationclip-length/page2 the script on that page fixes the animation. so thanks to alstonc99, Helmut Duregger and Robin1508, for making these scripts. I used the last version (on page 2, by Robin1508), and it worked like a charm.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mrldev · May 09, 2012 at 06:14 PM

Set a keyframe for the last frame and set to loop. You have no last keyframe.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adrianward · May 10, 2012 at 09:51 AM 1
Share

Sorry, that doesn't make sense.

1) I do have a last keyframe, the one I defined at 1:00 (frame 60). That's the last frame I want in my animation.

2) If I try to create a keyframe at the actual end of the current animation (let's say around 58:00), so be it. But that's not how long I want it to be! If I then either drag that keyframe leftwards to make it earlier, or delete it, the keyframe moves but the animation still stays at it's long length.

avatar image
0

Answer by mrldev · May 09, 2012 at 06:14 PM

I believe you have to set a keyframe at the last frame of your animation and the length is automatically picked up by first and last frames.. Not totally sure but I recall thinking the same thing and then finding the animation was the correct length after puzzling it over.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image adrianward · May 10, 2012 at 09:52 AM 1
Share

Thanks for trying but it's not working for me. Please see my comment to your first answer.

avatar image cregox · Oct 18, 2012 at 02:00 PM 0
Share

sometimes I wonder why people bother registering and typing stuff if they don't follow it up nor care if it helped or not... then I get back to getting a life.

avatar image
0

Answer by wowen · May 24, 2012 at 09:39 PM

I'm getting this bug too. I see that the previous answers don't understand that you've already set a keyframe on your last frame. Your animation is naturally starting at 0:00, and ending at 1:00, however Unity is extending the clip to 58:00 for seemingly no reason. You've got two keys, that's obvious, but Unity's acting like there's 3.

This is a very frustrating bug and I would also like a solution.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cregox · Oct 18, 2012 at 01:58 PM 0
Share

so you'd like to vote up the question and maybe add a comment to it. not such an invalid answer. bashed

avatar image
0

Answer by cregox · Oct 18, 2012 at 02:05 PM

If by any chance you're importing from an FBX and using Unity 4, you can edit the FBX Import Settings / Animations (look at the Inspector when you select the FBX), add a clip and set the length there. This actually works on Unity 3 as well, but I can't see the exact steps in here - I recall it's very similar though. ;-)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animation Timeline Last Frame Duration 1 Answer

Extract keyframe info from animation clips 2 Answers

Why isn't Cinemachine switching between cameras? 0 Answers

Rotating animation rotating backwards 360 degrees 0 Answers

Is there any good method to keep the collider constant while the local scale shrinking or expanding 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges