• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by Xdimx · Oct 26, 2016 at 10:24 AM · animationscripting problemlegacylost

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?)

alt text

And after it script is going to work!

But now, if I click on Cube, then there is no animation in Animation window....

alt text

Help please! How Can I get it??

снимок2.png (14.1 kB)
снимок1.png (31.2 kB)
Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

  • Sort: 
avatar image

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();
      }

Comment

People who like this

0 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Xdimx · Oct 26, 2016 at 01:34 PM 0
Share

sorry, I add answer, not a comment. It'doesn't begin to play...

avatar image

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. alt text

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...


снимок3.png (72.9 kB)
Comment

People who like this

0 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Xdimx · Oct 26, 2016 at 04:30 PM 1
Share

the solution is: Remove "Animator controller" and stay only "Animation component"

Unity Answers is in Read-Only mode

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta by June 9. Please note, Unity Answers is now in read-only so we can prepare for the final data migration.

For more information and updates, please read our full announcement thread in the Unity Forum.

Follow this Question

Answers Answers and Comments

151 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

RayCast and Animation not working 0 Answers

unity walk legacy animation clip not working properly 0 Answers

How to I create a light flash whenever the space bar is pushed? 0 Answers

Animation will not play when I call it in C# 1 Answer

How to immediately CHANGE SPEED from spotted position to another?) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges