Unity Spine切换动画

Unity使用Spine切换动画时会自动加入融合,这时动画会产生过渡的效果,如果想直接切换则按下图操作即可

把Default Mix Duration设置为0

Unity Spine切换动画_第1张图片

 

public void Awake()
    {
        skeletonAnimation = transform.Find("SkeletonAnimation").GetComponent();
        var animationState = skeletonAnimation.AnimationState;
        animationState.Complete += OnSpineAnimationComplete;//动作完成后的回调
    }


public void Run(Action __Callback)
    {
        Callback = __Callback;
        //切换动作
        skeletonAnimation.AnimationState.SetAnimation(0, "break", false);
    }


private void OnSpineAnimationComplete(TrackEntry trackEntry)
    {
        if(trackEntry.Animation.Name == "break")//break事件名
        {
            Callback();
        }
    }

你可能感兴趣的:(Unity功能,unity,spine)