Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Help Wanted Animator / Mecanim Best Practices

Discussion in 'Animation' started by FaffyWaffles, May 1, 2021.

  1. FaffyWaffles

    FaffyWaffles

    Joined:
    Apr 10, 2020
    Posts:
    19
    So...
    I've been developing with Unity for quite some time now, and am generally well versed with Mecanim.

    I'm already familiar with Blend Trees, State Machines, SubState Machines, Transitions and Layers.

    However, I've seen quite a few different ways people have set up their Animator, and I'm not sure which is the best, or why they do specific patterns at different times.

    For a few Examples-
    The hub and spoke:


    The shared entering/shared exiting pattern:


    The critical-section and settle pattern:



    I would really love to know what these patterns mean, and when/why to use them.

    ----
    Secondly: The Exit State

    I don't really understand the "exit" state, or when I should use that. I don't understand why some trees use it and some don't, and it what specific situations would really benefit from it.

    The main reason I have not been using it is because of the lack of a translational animation.

    If anyone had any insights, I would be very grateful.

    ----
    Last thing: Layers

    Should I be using layers as another sort of state machine? Should I have layers for , say, "Locomotion, Wounded, Dead, Attacking etc."?
    Or should I have them all on a single state and use layers for just local body limb stuff?
    ---

    I'd really appreciate any and all insight.

    Thanks
     
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    1,769
    My recommended best practice regarding Mecanim is to use Animancer instead (as you can no doubt tell from my post in your other thread).

    But back before I wrote Animancer, the best way I found for structuring Animator Controllers was to minimise the amount of logic they contain. Create the states you need and give non-looping ones Exit Time transitions back to the Idle state, but that's it, then use animator.Play("State Name") or CrossFade to directly play the state you want instead of setting parameters that might hopefully get it to transition to the state you want. That way you keep as much of your game logic as possible where it's supposed to be, i.e. in scripts written by programmers with all your other game logic instead of creating a mess in your art assets.
     
unityunity