How can i set the animation speed via codes?

Hello everyone,

As you see in the title, i would like to set animation speed via code. I created the animation and the controller in Assets folder and i don’t know how to control speed of these animation files.

You need to reference the animator and then you can set the speed:

public float animSpeed;
public Animator anim;

void Start()
{
  animSpeed = 1.0f;
  anim.speed(animSpeed);
}

void SetAnimatorSpeed(float newSpeed)
{
  anim.speed(newSpeed);
}