Search Unity

Animator with all state calling each other : What's the best way? [5.4]

Discussion in 'Animation' started by omegabytestudio, Jan 19, 2017.

  1. omegabytestudio

    omegabytestudio

    Joined:
    Nov 9, 2015
    Posts:
    77
    Hi there!

    I'm currently working on a game where all animations can transition to all others.

    Like punch->run,run->rolling,rolling->punch,punch->kick->idle

    The result was incredible, as I had control over everything, but as I had new animations, it becomes heavier and longer to do all the translations between states.

    Like If I create a animation, I have like 12 links to create, each with 2-3 conditions. In both direction.

    I'm looking for a better way to do this. Here What I found :

    1- Make a script to control animations by using Crossfade. My issue with this solution : I like the animator, it pain me to leave it for script. Also, I use event to call fonction frame by frame in the animator, It might be harder to implement via script?

    2- Use AnyState. I didn't expect much from this solution, but it actually works quit well. As all my state haves unique conditions set, I can use this easily. Every anytion is called via AnyState, with specific conditons. So I only have to create the link once. My only issue : Ex : If I translate from Any State to Run, all translation time will be identical for this translations. I can't set idle->run or punch->run with different value. Currently, it's not causing trouble yet, but I might try this if it happens :

    If I have 2 transitions, Any State->Run and Idle->Run, and both are called, which one will it take? If Any State isn't the first called, I could use this solution to override some transition that doesn't work well with the current translation time.

    Do you guys have any other idea or any opinions on this? I have been using animator for a long time, but I never tried anything complicated, so I'm not the best with it.

    Thank you!