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 Sprawl · Nov 22, 2017 at 08:54 PM · animationanimatoranimator controlleranimationclip

Animator Override Controller changed at runtime doesn't always play the animations correctly

EDIT : The issue was not linked to Animator Override Controller but instead on the culling of the character models.


I have a character that is animated with one controller and that uses AnimatorOverrideController to change the animation by script during runtime. The problem is that sometime when a new AnimationClip is set in the AnimatorOverrideController, the animation is shown as playing in the Animator window but it stays at the frame it was before I changed the animation clip. If I pause the game and resume, it seems the Animator realizes it is not playing properly and is fixed.


Here's how I create my AnimatorOverrideController :

 myAnimatorOverrideController = new AnimatorOverrideController(myAnimator);
 myAnimator.runtimeAnimatorController = myAnimatorOverrideController ;


Here's how I change the animation clip and play my animations :

 myAnimatorOverrideController[AnimationClipToOverride] = myNewOverrideAnimationClip;
 myAnimator.Play(OVERRIDE_ANIMATION_STATE_NAME);


AnimationClipToOverride is a referenceto the default animation clip in myAnimator. OVERRIDE_ANIMATION_STATE_NAME is the name of the state in myAnimator where AnimationClipToOverride is in.


I have tried using Rebind and Update after updating my override clip but it doesn't fix the issue. I thought it could be caused by the animations not being loaded since they were not referenced by the animator, but I tried referencing them to see if it would fix the issue but it doesn't. In all cases, pausing the editor or adding a breakpoint always make the animations play properly.

Comment
Add comment · Show 1
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 Sprawl · Nov 27, 2017 at 10:13 PM 0
Share

I am not able to reproduce this using simple animations. It seems to only happen in a more complex environment using Avatars. The animator window shows the animation as playing so it might have to do with the animator not playing correctly on the avatar. Since it fixes itself when I pause, there might be a function called on Animator Pause which fixes it.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Sprawl · Jan 11, 2018 at 04:11 PM

Sorry for the late reply. It turns out the issue was actually in the Import Settings and not the Animator override controllers. It seems they were changed at the same time that we introduced the Animator Override Controllers. The problem was that the models didn't have the right culling method. Setting them to "Always Update" fixes my issue.

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 WeByte · Dec 01, 2019 at 05:27 AM 0
Share

Hello! Can you tell me Where I can set them to "Always Update"? Thank you !

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

193 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

End of animation with animator. 0 Answers

How to reset animator controller ? 4 Answers

How to reset the animation after a gameobject is deactivated in Unity? 1 Answer

Animator Controller 2D RPG Best Practices 0 Answers

How to play an Animation only once from my MachineState Animator? 2 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