basically i am having collider issues and idk wat to do

so essentially i have code to detect a collision and then if its tag is equal too a building then it goes to that building only problem being that some buildings have box colliders that i use for radiuses to collect resources and it seems whenever it detects this radius then it just ignores the soon collision with the actual building here is my code unsure of what is wrong with it thanks for the help!!!`

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Colliderai : MonoBehaviour
{
    public float lookRadius = 10f;
    NavMeshAgent agent;
    public Transform target;
    public GameObject radiussawmill;
    public GameObject radiusquarry;
    public GameObject radiusoilrig;
    public void OnCollisionEnter(Collision collision)
    {
        print("touch");
        if (collision.gameObject.name == "prefabsawmill" )
        {
            target = collision.gameObject.transform;
            Target();
        }
        else
        {
            Physics.IgnoreCollision(radiussawmill.GetComponent<Collider>(), GetComponent<Collider>());
        }
    }
    private void Start()
    {
        agent = GetComponent<NavMeshAgent>();
    }
    void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(transform.position, lookRadius);
    }
    void Target ()
    {
        
        float distance = Vector3.Distance(target.position, transform.position);

                if (distance <= lookRadius)
                {
                        agent.SetDestination(target.position);

                    if (distance <= agent.stoppingDistance)
                    {
                        Vector3 direction = (target.position - transform.position).normalized;
                        Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x, 0, direction.z));
                        transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * 20f);
                    }
                }
    }
}`

I think you need to move those colliders to a different transform. For example you could make a child on the building that is just for the resource collection collider and set its layer to something else. That way you know when you are colliding with the building in one way verse the other. I suggest looking at Unity Collision layers. With this you can have your ColliderAI not collide with anything but what its interested in: Unity - Manual: Layer-based collision detection