On the unity manual it is written:
“If you have Has Exit Time selected for the transition and have one or more conditions, note that the Unity Editor considers whether the conditions are true after the Exit Time. This allows you to ensure that your transition occurs during a certain portion of the animation.”
But on my test, the transition condition is only checked onceon the “Exit Time” frame and not after.
Is it a normal behaviour ? (I’m on the 2020.3LTS) Can’t we just have the animation time in the condition list ?
What is the best way to make transition condition check after a certain duration of the animation ?
I am interested in the same, how could you trigger specific conditions after lets say 30% of the animation has played.
This could be solvable via scripts, but I am trying to figure out how to use the native tools before coding my own solution.
Yeah, I reckon thats the case, I actually been eyeing your Animancer plugin, just because it seems to solve quite a bit of hassle, I just need a good ui built on top of it, similar to Mecanim. I guess thats an option.
I am interested in making transitions between animations that mesh decently, - think combos in Devil May Cry game. That requires gameplay and good animation transition.
How far off animancer is of that ? Specific transitions and blends?
Animancer’s Transitions are a bit different from those in Animator Controllers. Instead of being a specifically defined pair of “A → B”, Animancer’s Transitions are just the " → B" part and it’s entirely up to you when to tell it to play a transition.
It also has End Events which would be useful for this situation because they are actually triggered every frame after the specified end time has passed, so if you want it to do something if 30% of the animation has passed and another condition is met, it could look like this:
[SerializeField] private AnimancerComponent _Animancer;
[SerializeField] private AnimationClip _Animation;
void PlayAnimation()
{
var state = _Animancer.Play(_Animation);
state.Events.OnEnd = OnAnimationEnd;
state.Events.NormalizedEndTime = 0.3f;
// Or set the time and callback at the same time:
state.Events.endEvent = new AnimancerEvent(0.3f, OnAnimationEnd);
}
void OnAnimationEnd()
{
if (CheckYourOtherConditions())
{
_Animancer.Play(// the next animation.
}
}
Or if _Animation was a transition (probably a ClipState.Transition), you would be able to set its end time in the Inspector so that you can easily tweak and preview it. You can also set the callback in the Inspector like other Animancer Events, but I generally prefer setting them in code because it keeps all your actual logic inside the scripts.