Animator problems with transition

I have some problems with my animator,if i make transition between 2 animations(they are on the same object) it will play first then the other.I want to make my idle animation play indefinitely until i call from my script the movement animation.
How can i make it work as i want ?

  1. The idle animation should be set to loop.
  2. There needs to be a condition to cause the transition to the second animation to happen. i.e. When this button is clicked the animation transitions from idle to the second animation.

Depending upon your requirement, this can be set to transition automatically or it can be set to transition when the idle cycle finishes.

Check the animation section under learning.

the 2D section also covers this subject in-depth.