About how Unity's Animation detects the start and end of animation playback

 public void PlayAnimation(Animation animation, string clipName, Action startAct, Action endAct)
    {
        StartCoroutine(PlayAnimationItor(animation, clipName, startAct, endAct));
    }


    private IEnumerator PlayAnimationItor(Animation animation, string clipName, Action startAct, Action endAct)
    {
        startAct?.Invoke();

        AnimationState animationState = animation[clipName];
        animation.Play(clipName);

        yield return StartCoroutine(new WaitForEndOfAnim(animationState));

        endAct?.Invoke();
    }

Supongo que te gusta

Origin blog.csdn.net/qq_37335907/article/details/125142409
Recomendado
Clasificación