Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
avatar image
0
Question by snuffysam · Aug 28, 2015 at 09:41 PM · animationphysicsscriptingproblemlegacylegacyanimation

Character spins constantly when using legacy animation, game claims animation does not exist.

I created a model with an animation in Blender, exported as an fbx, and imported into Unity. The animation is actually a series of animations that were strung together in Blender for convenience, so when importing the fbx, I split the animation into 10 animations. I also set the animation as Legacy, because Unity told me to.

Then, I added an animation component to my object, and set all the animations as elements under the Animations tab.

Lastly, I modified the player's movement script so that if no buttons were pressed, the code "GetComponent ().Play ("Normal");" would play.

However, when I try to run my game, two things happen: the message "The animation state Normal could not be played because it couldn't be found! Please attach an animation clip with the name 'Normal' or call this function only for existing animations." would show up in the console any time the line of code was called, and the player would spin around uncontrollably.

It can't be anything in the movement code, because it works fine if uncheck the animation component. The animation shouldn't be affecting the physics anyway, as the object has a box collider and I have "Animate Physics" unchecked.

So what's going on?

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 snuffysam · Aug 30, 2015 at 12:12 AM 0
Share

If I explained my problem poorly, I can upload a unity file for anyone who wants to see.

avatar image DiegoSLTS · Aug 30, 2015 at 02:36 AM 0
Share

If you run that line of code whenever the player is not pressing any key then you're running that line on multiple consecutive frames, is that what you want? Should you play the animation when nothing is being pressed AND any of the movement keys was released in the current frame?

Also, I'd use an animator ins$$anonymous$$d of the animation component, setting the "Legacy" when importing the FBX doesn't prevent you from using an animator.

Anyway, I'm not sure why would your character spin, so... can you share the Unity file? I'd like to see it.

avatar image snuffysam · Aug 30, 2015 at 10:25 PM 0
Share

@DiegoSLTS Here's the unity file: http://www.mediafire.com/download/x42378we8chnrja/AnimationTest.zip

Yes, the code is run on multiple consecutive frames, but I'm planning on getting all my conditions in order once I've sorted this out. For example, an easy condition would be to not play the animation if it's already playing, but seeing as the animation apparently doesn't exist, I figured I'd wait until I figured out what was going on.

I tried creating an animator, but it wouldn't let me add the animations- unless I was doing it wrong? The manual isn't very clear.

Thanks for all your help.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by DiegoSLTS · Aug 30, 2015 at 11:58 PM

I think I found the main problem. Look in the hierarchy, go to goku -> Armature -> Bone.021, there's another "goku" GameObject as a child with a RigidBody, BoxCollider, Animation and MovementScript components. It looks like you made a copy of it by mistake or something like that. Removing or deactivating that GameObject will stop that weird rotation.

It looks I was wrong about using the animator when importing the FBX rig as Legacy. I couldn't do it either, I've done that in other projects but I think I used .blend files, not FBX.

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 snuffysam · Aug 31, 2015 at 12:12 AM 0
Share

Thanks! Can't believe I didn't notice that!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

UNET NetworkAnimator Compatible with Legacy? 0 Answers

Why I can't play animations in my 2D game? 0 Answers

Legacy Animation doesn't work... 1 Answer

How to play animation (C#) 3 Answers

Why my animation isn't working with Mecanim 0 Answers


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