1.For imported animation
If you're using the Animation component,you need to import the rig as Legacy.
If you import the rig as Humanaoid, you need to use anAnimator component (Mecanim) and an Animator Controller. You can'tuse animation.Play().
Assuming that you're using the legacy animation system (andnot Mecanim):
Open the Animation view window (Window > Animation). Selectyour character. Then select an animation clip from the drop-downmenu. This will allow you to view (and edit) the animation curvesdefined on each bone.
If you see "Clean Up Leftover Curves," then for some reasonyour imported model's skeleton doesn't match the skeleton definedin the animation clip.
Otherwise, you can press the play button to play the animationclip your character in-editor.
Make sure all this works before writing any code.
2.For animation created by unity Mecanim
Set the inspector to Debug mode ,andthen set animation Type to 1(Default is 2 ),and uncheck LoopTimecheckbox.(Tips: you can change wrap Mode here too,defaultyou can't set the wrapmode of mecanim's animation)