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");
}
}
}