Is it possible to use root motion on concrete animations only?

Hi guys! I’m using Spine for my 2d platformer character animations. I’m going to use Root Motion for animations like attacks and roll, but i have scriptable physic based movement and jumps. Is it possible to use root motion on concrete animations only, or i should make all character actions based on it?

I think you can use OnAnimatorMove() callback to manually calculate transform like this:

public class Example : MonoBehaviour
{
    ...

    void OnAnimatorMove()
    {
        if(needRootMotion)
            {
                transform.rotation *= _Animator.deltaRotation;
                transform.position += _Animator.deltaPosition;
            }
    }
}

Are Existed some variants,
One - you put this script to GameObject with Animator (after that the field “Apply Root Animation” automatically are switched to “Handled by Script”)

public class ApplyRootMotionToClip : MonoBehaviour
{
    Animator anim;
    int hashAnimTurn;

    private void Awake()
    {
        anim = GetComponent<Animator>();
        hashAnimTurn = Animator.StringToHash("TurnRight");
    }

    void OnAnimatorMove()
    {
        AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0);

        // APPLY DEFAULT ROOT MOTION, ONLY WHEN IN THESE ANIMATION STATES
        if (stateInfo.shortNameHash == hashAnimTurn)
        {
            anim.ApplyBuiltinRootMotion();
        }
    }
}

I use other, It’s also attached to Animator, but It is controlled through variables from my State Machine

        void OnAnimatorMove()
        {
            if (_playRootMotion)
            {
                _playerAnimator.ApplyBuiltinRootMotion();
            }
        }