how can i enable a unity component in my player gameobject when its animation ends?

hi so, i have a prompt script and so, the player starts a killing animation and its movement component disables, so it can play that animation but when the animation ends i dont know how to turn it on again on the script, i need help really fast. Please. `
case PromptType.Attack:

            Player.GetComponent<MovementPC>().enabled = false;
            Player.GetComponent<Animation>().CrossFade("f02_knifeStealthA_00");
            Player.GetComponent<Animation>().Blend("f02_yanderePose_00", 100f);
            Vi.GetComponent<Animation>().Play("f02_knifeStealthB_001");
            AttackSound.Play();
            Debug.Log("Entered Attack type!");`

You can achieve it by:

  1. Getting the length of the animation clip with Animator.GetCurrentAnimatorClipInfo and manually setting a coroutine that waits for that amount of time to enable the component.

  2. You can implement the StateMachineBehaviour and listen to the OnStateExit event.

  3. Simply add a keyframe to your animation that enables/disables the component, as every component’s enable property can be animated.