My enemy collision is not working

The code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class EnemyPathfinding : MonoBehaviour
{

public Transform target;
private bool TouchingPlayer;
private bool TargetLocation;
public bool IsTouchingPlayer;
public Transform transform;
NavMeshAgent agent;

private void Awake()
{
    agent = GetComponent<NavMeshAgent>();    
}

void OnCollisionEnter(Collision collision)
{
    if (collision.gameObject.name == "Douglas")
    {
        IsTouchingPlayer = true;
        TargetLocation = agent.SetDestination(transform.position); ;
    }
}

private void Update()
{
    if (IsTouchingPlayer)
    {
        TargetLocation = agent.SetDestination(target.position);
    }
    
}

}

may be u have’t added the colliion collider on your object and set to on triger

Add regitbody for detect collition .
you can check with

private void OnTriggerEnter(Collider other)
{
}