I have a running game where enemies are constantly moving toward you. These enemies are spawned at random locations. The problem I am facing is that they tend to overlap whenever they respawn. So, to overcome this issue, I am trying to implement the Physics.CheckSphere function. The problem, is that when I assign them to a layer, it seems to not work… When I assign it no layer, all they do is continually respawn. This is probably because of the ground interacting with their sphere. I’ve assigned all of the enemies to layer 8, and have noted it in the CheckSphere parameters… Here is the code:
if (Physics.CheckSphere(transform.position, 15f,8)){
RandomPosition();
}
Any ideas why this wouldn’t be working within the layers?