Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • 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
0
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
Add comment
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

· Add your reply
  • Sort: 
avatar image
0

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
Add comment · 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
0

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
Add comment · 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"

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

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

Unity animator always running only one animation...... 1 Answer

How can I improve this code? 1 Answer

skip a bit forward in current animation? 0 Answers

2D Spine Animation not playing 0 Answers

How do I get my animated Object to switch animations on Collider? 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