MissingComponentException

MissingComponentException: There is no ‘Animator’ attached to the “Aim” game object, but a script is trying to access it.
You probably need to add a Animator to the game object “Aim”. Or your script needs to check if the component is attached before using it.
UnityEngine.Animator.SetTrigger (System.String name) (at :0)
PlayerAim.HandleShooting () (at Assets/Using/Player/PlayerCode/PlayerAim.cs:39)
PlayerAim.Update () (at Assets/Using/Player/PlayerCode/PlayerAim.cs:23)

using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography;
using UnityEngine;
using CodeMonkey.Utils;
using System;
using System.Collections.Specialized;

public class PlayerAim : MonoBehaviour
{
private Transform aimTransform;
private Animator aimAnimator;

private void Awake()
{
    aimTransform = transform.Find("Aim");
    aimAnimator = aimTransform.GetComponent<Animator>();
}
    
private void Update()
{
    HandleAiming();
    HandleShooting();
}

private void HandleAiming()
{
    Vector3 mousePosition = UtilsClass.GetMouseWorldPosition();
    
    Vector3 aimDirection = (mousePosition -  transform.position).normalized;
    float angle = Mathf.Atan2(aimDirection.y, aimDirection.x) * Mathf.Rad2Deg;
    aimTransform.eulerAngles = new Vector3(0, 0, angle);
}

private void HandleShooting()
{
    if (Input.GetMouseButtonDown(0))
    {
        aimAnimator.SetTrigger("Shoot");
    }
}

}

My animation is in the “Pistol” gameObject, but it is looking for the “Aim” Gameobject how do I change from aim to pistol?

Read the exception


MissingComponentException: There is no ‘Animator’ attached to the “Aim” game object, but a script is trying to access it. You probably need to add a Animator to the game object “Aim”. Or your script needs to check if the component is attached before using it.