unity quick sprite sheet to animation code example
Example: animate sprite sheet unity in code
[SerializeField] Animator anim;
//must drag in the animator that you are using
public void StartAnimation()
{
//can be a float, int, bool, or trigger
//string is the name of the parameter in the animator
anim.SetBool("isAttacking", true);
}