Animation is lost after change to Legacy
Hello!
Unity 5.4.1
Try to make simple animation of cube. Made it rotation in Animation window (animator controller was added by Unity)
Then I added "Animation component" to Cube.
Then, I added script to Cube:
 public Animation myAnimation;
 
 
     void Start () {
         myAnimation = GetComponent<Animation>();
     }
     
 
     void Update () {
         
         myAnimation.Stop("cube_animation2");
     }
 
               It didin't work, and wrote Mark animation as "Legacy".
I marked it, in Debug mode (is it any other way to do it?)

And after it script is going to work!
But now, if I click on Cube, then there is no animation in Animation window....

Help please! How Can I get it??
Answer by aditya007 · Oct 26, 2016 at 10:53 AM
If you created an animation and Unity added an 'Animator Controller' by itself. Then you don't need to add another Animationcomponent. And change your script to this : (Not tested, but should work)
 public Animator myAnimation;
  
  
      void Start () {
          myAnimation = GetComponent<Animator>();
      }
      
  
      void Update () {
          myAnimation.Play();
 //similarly
          myAnimation.Stop();
      }
 
              sorry, I add answer, not a comment. It'doesn't begin to play...
Answer by Xdimx · Oct 26, 2016 at 12:43 PM
Thank you very much! Have done exactly what you wrote, but still have a problem.
Create Sphere, make animation, Animator component created by Unity. 
Add script.
 using UnityEngine;
 using System.Collections;
 
 public class sphereScript : MonoBehaviour {
 
     public Animator anim;
 
     void Start() {
         anim = GetComponent<Animator>();
         anim.Stop();
     }
     
 
     void Update () {
         if (Input.GetMouseButton(0)){
             print("sphere: I press mouse button");
             anim.Play("sphereAnimation");
 
         }
 
     }
 }
 
 
               It Stop playing animation, but doesn't start it by clicking mouse button...
the solution is: Remove "Animator controller" and stay only "Animation component"
Your answer