Playing an animation from code

I’m trying to play an animation from code using the following lines:

Animator mAnim = this.GetComponent<Animator> ();
...
mAnim.Play("Ui_In", 0);

But instead of playing the animation, the following warning is issued:

A screenshot of the states in the animation controller is attached.
What could be the cause of this problem? Thanks!

I think this will help you:
https://unity3d.com/learn/tutorials/modules/beginner/animation/animator-scripting

So there is no way to do this without transitions and triggers?
Seems somewhat overcomplicated…

What I meant is… try this:

    Animator anim;
    int yourAwesomeAnimation = Animator.StringToHash("Ui_In");


    void Start ()
    {
        anim = GetComponent<Animator>();
        PlayYourAwesomeAnimation();
    }

    void PlayYourAwesomeAnimation()
    {
       anim.Play(YourAwesomeAnimation);
    }