Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
2
Question by barbe63 · Jan 30, 2015 at 11:04 PM · animatortransition

Problem with animator any state and transitions

Hello,

I'm having some weird troubles using Animator state machine when it involves "Any state". Basically the transition time between "Any state" and an animation seems to be calculated from the length of the "Any state" animation. That means if i'm going from walk animation (from AnyState) to a death animation, the transition time will be faster than if i go from an idle animation which is 10x longer. That causes some heavy bad behaviours on my animations. The only way i found to "fix" this is to do without "Any state" which of course is making a big mess in my Animator state machine window. I also reduced the length of my idle animation to minimize this issue...

Do you know a proper fix? Is it possible that unity will fix this and make a fixed transition time regardless to the animation length?

Comment
Add comment · Show 6
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 nurikabe · Jan 30, 2015 at 11:44 PM 1
Share

Another workaround may be to use the Animator Crossfade method. The normalized time parameter can be calculated by dividing the desired crossfade length by the length of the current animator state.

 float normalized = crossfadeLength / contextAnimator.GetCurrentAnimatorStateInfo(animationLayer).length;
 contextAnimator.CrossFade(animHash, normalized, animationLayer, 0f);
avatar image barbe63 · Jan 31, 2015 at 12:04 AM 0
Share

I guess i could give it a try.. Thanks!

Edit: So far it looks like to be a great workaround! I put my transitions back to Anystate and even more than i had thanks to this.

Edit2: never$$anonymous$$d... more issues, read below

avatar image meat5000 ♦ · Jan 31, 2015 at 01:58 AM 0
Share

Avoid using Any State.

avatar image barbe63 · Jan 31, 2015 at 03:42 AM 0
Share

Damn, i'm still having issues i can't understand. In some occasions the animator skip the last order probably because it been called too soon after some other (at least it's the only conclusion i get) If the problem seems familiar to you please i'm struggling against this for more than a month...

Now I have a system that guarantee only one crossfade per late update(the last one) but it's still not right on (not so) rares occasions.

I fixed most of my issues by unchecking atomic on all my transitions. It seems with crossfade this option is not available so it's probably why it ignores some transitions... What do you think?

Too bad.

avatar image barbe63 · Jan 31, 2015 at 03:48 AM 0
Share

@meat5000 Can you please explain the reasons for that? The same that I mentionned or more?

It looks like I will follow your advice anyway and my state machine will soon looks like spaghettis again :'(

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by barbe63 · Jan 31, 2015 at 04:31 AM

Please... This is so dumb, look at how the lack of one option (normalize transition or atomic for crossfade) turn my state machine into hell...

alt text And my game is far from being finished... I really can't understand what could be the purpose of setting transition time based on ... current animation length???


beforeafter.png (253.6 kB)
Comment
Add comment · Show 3 · 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 Derek-Wong · Jan 31, 2015 at 05:32 AM 0
Share

this is....stunning. I believe you can set the transition time by pulling those line on the time graph in the inspector when you click the tranaition arrow, hope it can help.

avatar image barbe63 · Jan 31, 2015 at 06:14 AM 0
Share

You can't, the transition time you set this way is for all the transition from any states and it's percentage based on the animation length. No way to set different transition time from different states in Any state, or i don't know it.

The funniest part is now I almost don't use Any state anymore, i didn't even had to set diffferent transition time for any of the transition that were causing troubles before.

That means the Any state is using length of the current animation to calculate transition time while normal transition doesn't or at least set a default time that is suitable regardless to the animation length...

avatar image dreg_master · Oct 27, 2017 at 01:17 AM 0
Share

Hahahahah. that Awesome.

avatar image
1

Answer by AllFatherGray · Jun 27, 2015 at 12:12 AM

You can add a StateBehavior script to catch and fix the problematic values of your states.

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

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

24 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

Related Questions

Animator event at the end of transition. 2 Answers

Animator State Changing but animation changes only after one animation is complete 0 Answers

2D animations transitioning too quickly and looping before finishing 2 Answers

Mecanim animator layers 0 Answers

I cant add transition on unity animator 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