• 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 /
avatar image
0
Question by ivarhill · Feb 22, 2014 at 03:51 PM · animationanimationsplay4.3

Play animation from script in Unity 4.3

I'm trying to play a simple animation from a script in Unity 4.3, but can't get it to work. If it's a legacy animation, Animation.Play("name") works fine as it always has - and that does work if I force all my animations to legacy, but those don't support everything the new system does. A few of my animations change material properties which doesn't seem to work in legacy animations, for instance.

I really don't want to do anything complex, my animations are really simple - but I don't get how to simply start an animation clip in code (C#) - Animation.Play() does not work at all with the new system. For that matter, I can't see an option to disable play automaticall with the new animations either. Can anyone help me out here?

Comment
Add comment · Show 3
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 ryanas · Feb 22, 2014 at 03:57 PM 0
Share

What do you mean by new system? Do yoou mean generic animations? Tried animationPlay("animationName")?

avatar image ivarhill · Feb 22, 2014 at 08:47 PM 0
Share

@ryanas: animationPlay does not seem to exist - animation.Play yields the following error: issingComponentException: There is no 'Animation' attached to the "gameobject" game object, but a script is trying to access it.

Generic animations is probably what I am referring to, yes.

avatar image ryanas · Feb 23, 2014 at 04:33 PM 0
Share

Have you tried manually creating an animation using keyframes and then running the script? I had a similar issue where I imported .m2 files and the animations would only be included when the import is set to "legacy". Try to create a simple transformation, name it and call it in the script. If that works then your models require legacy to use their imported animations.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 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

Related Questions

multiple animations that play automatically 1 Answer

what is the jump axis for if (Input.GetAxis(" ? ") 2 Answers

Can't script multiple animations on the player? 1 Answer

How do i make an animation play on key press? 3 Answers

animating objects, end position changes 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