so I’m trying to make a destroy everyone within radius and thought overlap sphere would be best bet but cant seem to write the right code to destroy other game objects everything I try just destroys my player right away. ive made a layer mask and changed it in inspector and was still doing it.
any help would be awesome
public float radius = 0f;
public Collider[] colliders;
public LayerMask mask;
void LateUpdate ()
{
colliders = Physics.OverlapSphere (transform.position, radius, mask);
foreach (Collider col in colliders)
{
// destroy game objects in radius here
}
}
}