How to use OnStateMachineEnter function in StateMachineBehaviour?

I look up document and other link,but still don’t know how to use OnStateMachineEnter function.
I write code in OnStateMachineEnter and put on the state,but it didn,t work.
Anyone can give me a small demo or a picture?

here is my code

public class AnimatorRunBehaviour : StateMachineBehaviour
{
    private float m_walkspeed = 2f;
    private float m_runspeed = 5f;
    private Transform playerTransform; 

    public override void OnStateMachineEnter(Animator animator, int stateMachinePathHash)
    {
        playerTransform = animator.gameObject.transform;
        Debug.Log("<color=red>look at this</color>");
    }
}

I will be very appreciate if anyone can guide me a little.

I know why OnStateMachineEnter do not trigger…Pay attention on the name of the event. OnStateMachineEnter is just triggering on transition from someone to statemachine. for example…Sub-StateMachine…I just place StateMachineBehaviour on the sub-StateMachine…OnStateMachineEnter is triggered.