why is my animation not playing

my animation is not working. please i don’t know what is wrong. it shows signs that it wanna start workin but just glitches back to the default idle animation. heres the short code to trigger it.

 public void run()
    {
        anim.GetComponent<Animator>().SetTrigger("run");

}

i dont know if its because i didn’t keep it in the update function

@xibanya