Two instantiated gameobjects of same prefab are not triggering collision with each other

Actually I’m working on some collision game, I have 2 prefabs 1 is player and other is Guard But when I instantiate Guard prefab 2 times and they collide with each other nothing happens.
But when they collide with the player it works completely fine.
I’m using Tags for the Detection.
Here’s my code:

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

public class GuardCollision : MonoBehaviour {

	public Vector3 spawnValue;
		
	void OnCollisionEnter (Collision collider){
		if (collider.gameObject.CompareTag ("Guard")) {
			Debug.Log ("It's a guard");
		} else if (collider.gameObject.CompareTag ("Player")) {
			Debug.Log ("It's a Player");
		}
	}

}

hi Abhibundela, to use collision atleast 1 of the colliding objects needs to be an rigid body. They both need to have an collider object. Maybe your player is a rigidbody but your guards arent? Then make both of them rb’s. You can use the ‘is kinematic’ if you dont want all the physics nonsence that comes with the rb :).
Also double check if your tags are correct.
Good job on just console logging a check to see if the collision works, rather then smacking your whole code in there and then not knowing where it goes wrong. Narrowing the problem is the biggest step towards solving it :).

I finally figured it out, since I’m using AIThirdPersonController as my Guard ,it has a property to avoid obstruction.
It means except its target it will treat every other gameobject as Obstruction and avoid it with the minimum safe radius set in Obstruction avoidance component.
Set the obstruction avoidance radius to minimum then it will collide with other gameobjects also.