Search Unity

Question How to un-mess a messy state machine

Discussion in 'Animation' started by dev_34Disorder, Jan 15, 2021.

  1. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    The animator controller for my 3D character currently looks like this:


    For every state i have to make a transition to every other state it could possibly go to. There must be a better way to do this... right? The reason i don't just make every transition come from [any state] is because some transitions have to be smooth, some have to be instant, and some have to have exit time, which all depends on which state it's transitioning from. Theoretically i could manage transitions by adding a butt-ton of parameters that control what kind of transition (exit time, duration, etc.) to use when going from [any state], but that would pretty much just move the mess from animator to script, which fixes nothing. Any ideas on how to fix this nightmare of arrows?
    Thanks
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,565
    animator.Play and CrossFade let you change the state without setting up a transition.

    You might also be interested in Animancer (link in my signature) which lets you avoid Animator Controllers entirely and control everything in code. The Why Replace Mecanim section explains the main problems with Animator Controllers and how doing it in scripts avoids those issues.
     
  3. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    I was thinking about using play/crossfade but that doesn't seem to support exit time. I will definately take a look at Animancer though. Thanks!
     
  4. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    Quick question: does Animancer Lite support changing of transition duration and animation speed? The features page seems to say that to do it 'dynamically' i'd need Animancer Pro, but does Lite allow me to do that at all? Also, can i use Animancer Lite for commercial games? Sorry if this seems desperately stingy but i'm really unable to spend this much money on Pro currently, you know, 'rona and all.
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,565
    No, the Lite version doesn't let you use any fade duration other than the default 0.25 seconds and the default speed. It lets you do everything in the Unity Editor to see what you can do with Pro, but not in runtime builds. So if you aren't going to be releasing your game in the immediate future, you could start using the Lite version now and upgrade to Pro when it's next on sale (I think the first sale last year was in April).

    And yes, it can be used in commercial games.
     
  6. dev_34Disorder

    dev_34Disorder

    Joined:
    Aug 7, 2018
    Posts:
    47
    Ok, i understand now. I'll keep looking for solutions using mecanim but if that doesn't work then i'll try to transition to Animancer. Thank You!
     
  7. transporter_gate_studios

    transporter_gate_studios

    Joined:
    Oct 17, 2016
    Posts:
    219
    I love how in every thread about animator problems, instead of finding answers from Unity is just this one guy pushing his paid solution. i guess im not surprised animation is yet another broken built in feature of unity.
     
  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,717
    In fairness, there are no answers to be had from Unity.

    Maybe "use sub-states"?

    This was an image posted on the Unity blog from Recore.



    There is no way to avoid it becoming a mess, no matter how much you try.
     
    dev_34Disorder likes this.
  9. TheChairMaster64

    TheChairMaster64

    Joined:
    Aug 9, 2016
    Posts:
    59
    I know this is old but holy crap lmao... and I thought I had a problem with like 5 states and a few conditions. I have no idea how you would even keep track of something like that geezzz.
     
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,717
    I used to have a piece of paper where I would write down the rough positions of certain animations I was working on so I could find them again on the controller ("'pick up' is at 1 o'clock towards the top").

    Being able to search for the name of a state in the animator seems like such a gimme and an easy win, it boggles the mind why it was never implemented. But then again, this is the company that took 5 years to implement zooming in and out the animator.

    But don't worry, they have neglected their animation tools for a decade and are now working on complete replacements, which are at least a couple of years away and will totally have all these things solved and will not instantly get abandoned like their current feature set.