Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Question about exit condition precedences

Discussion in 'Animation' started by tHE_uKER, Nov 6, 2019.

  1. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    18
    I have an animation that has two exit transitions.
    One of them is via exit time = 1, making the animation exit when it finishes playing, returning to idle.
    The other is via a variable condition, which makes the animation merge into another one, returning to idle after that.

    The thing is, apparently changing the variable while the first animation is playing is not taking me into the second one. Instead, the whole animation plays, and the thing returns to idle.

    I also tried defining a trigger to take me into the second animation, but while I haven't examined too carefully, I get the feeling that I'm getting the whole first animation playing before it switches to the next one.

    So question is is this supposed to be so? If I define a transition via exit time I'm stuck having to have that animation playing in full before being able to switch into something else?
    If so, is there any way to work around this?

    Any input will be appreciated.
     
    Last edited: Nov 7, 2019
  2. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    596
    It doesn't sound like that should be how it works, but some of the design decisions behind Mecanim are pretty strange and this behaviour probably isn't documented anywhere so the intended behaviour is anyone's guess.

    Fiddle with the settings and your script. Make sure the parameter is actually getting set correctly and the transition is checking the right parameter. Maybe the order of the transitions makes a difference or something.

    If you get sick of wasting time trying to fight that stupid system to accomplish every simple task, you might be interested in Animancer (link in my signature) which gives you full scripting control over everything and excels at actually doing what it's told.
     
    tHE_uKER likes this.
  3. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    18
    Thanks! I'd rather stick to the builtin stuff, but I'll see to take a look at Animancer.

    Regardless, if anyone else can provide any clarification it will be greatly welcome.
     
  4. tHE_uKER

    tHE_uKER

    Joined:
    Oct 19, 2019
    Posts:
    18
    Figured it out.
    The problem was that the transition going from the first state to the second had exit time = 1, so the condition was only evaluated after the animation played.
    Removed exit time and now it switches as soon as the variable changes, as I intended.