Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
5
Question by MilosDj · Apr 07, 2017 at 03:03 PM · animationfpssamplesample rate

What is Samples in 2D Animation and how to change animation speed correctly?

So far I've found 2 contradictory and one half answer.

Answer 1 states that you simply change 'Samples' number and you are good to go. There is this answer suggesting the same thing.

-This works, but partially. Lower the number, lower is the speed. But some numbers create a glitch. Animation becomes jerky, not animating, or waiting for some time than animating too fast. For example I created one anim with sample rate 12. Values 12, 9, 8, 7, 6, 5 are ok. Anim goes slower with each value. But 11 or 10 create glitchy animation. For another anim with sample rate 30, different numbers create smooth or glitchy animation.


Answer 2 tells us that changing 'Samples' is misleading and have no effect on animation speed.

-That is wrong because changing 'Samples' number does have effect on animation speed. Depending on value, slower, faster or unpredictably glitchy.


Answer 3 says that Unity drops animation frames if animation fps > game fps.

Unfortunately it doesn't say anything what happens when game fps > animation fps. How is that handled? How to avoid glitch in animation?


So far I just play with the 'samples' numbers and see what works. But that's not good enough. For static (unmovable) animations everything is more or less ok. Usually everything is animating on PC but not on Mac.

Problem arises when I try to move animating objects or animate on trigger. For some 'samples' values all's well. But for other values it doesn't animate at all, or glitch and jerk and looks ugly.

Why? What is going on?


Bonus question: can anyone explain or provide a link to what is going on "under the hood" in 2D animation. How is it done, why are default 'Samples' values different for animations (12, 30, 60...), are there some performance or optimization tricks?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by DigitalWizrd · Jan 09, 2018 at 03:46 PM

Not sure if you are still waiting for an answer on this, but I did some searching and found that the samples are how fast the animation was created. To change the animation playback speed you can change the Animation property AnimationState.speed.

See Animation here: https://docs.unity3d.com/ScriptReference/Animation.html

and AnimationState.Speed here: https://docs.unity3d.com/ScriptReference/AnimationState-speed.html

See this response here as well: https://answers.unity.com/questions/64822/changing-the-animations-sample-rate-property-has-n.html

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 kevinciang1006 · Jan 07, 2020 at 06:50 AM

You can also try to the enable the Multiplier Parameter. Go to your Animator tab, add a new float parameter "SlowEffect" (for example) and then select the animation state/clip of your choosing. Tick the Multiplier checkbox parameter then select the "SlowEffect" parameter. Once that has been set, you can go to your code and set the float for "SlowEffect" by using Animator that you have referenced. This will multiply the AnimationClip speed with the multiplier.

 public Animator _animator;
 
 void Start() 
 {
        _animator.SetFloat("SlowEffect", .5f);
 }
   
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

6 People are following this question.

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

Related Questions

Animation sample rate not scaling correctly. 0 Answers

Unity 3 Animation Positioning Problem 1 Answer

Character wont stay aiming 0 Answers

where should i put weapons in fps character unity 2 Answers

Hot to use walking animation while aiming! 0 Answers


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