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?

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: Unity - Scripting API: Animation

and AnimationState.Speed here: Unity - Scripting API: AnimationState.speed

See this response here as well: Changing the animation's "sample rate" property has no effect? - Questions & Answers - Unity Discussions

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);