I have a unity-c# code that will spawn player on position(0,1,0) on start. I want them to be able to overlap on the same position.
Right now my code only spawns 1 player. but when I drag another one from my prefab they cant overlap. they just collide. I am planing to add at least 50 players and I do not want to create layers for all of them.
void OnCollisionEnter(Collision info)
{
if(info.collider.tag != "Ground")
{
if(info.collider.tag == "Player")
{
}
else
{
this.enabled = false;
FindObjectOfType<GameManager>().EndGame();
LastLocation();
}
}
}
public GameObject player;
[SerializeField]
public Transform respawnpoint;
// Start is called before the first frame update
void Start()
{
Instantiate(player, respawnpoint.position, Quaternion.identity);
}
If I understand your question, you could put a layer on your player prefab, and simply uncheck this layer with himself in the collision matrix under Project settings > Physics.