2D Mobile Game
Objective: Set a condition for Skeleton to move only when the walking animation is being played.
Here, take a reference to your animator component which in my case is inside my gameobject as a child gameobject. Then check the animator state with the animation name Walk which will return true if currently playing which will then enable movement.
This is the animator and as you can see the animation name is the same as in the script and since the Idle has a exit time, every time Idle completes, walk animation plays and enemy moves.
And this is the final result.