here is my script
public float radius;
public LayerMask check;
public bool active = true;
GameObject enemy;
private void Update()
{
if (active == true)
{
Collider[] colliders = Physics.OverlapSphere(transform.position, radius, check);
Array.Sort(colliders, new EnemyDetector(transform));
foreach(Collider item in colliders)
{
// I think the game object should go here.
}
}
}
private void OnDrawGizmos()
{
Gizmos.DrawWireSphere(transform.position, radius);
}
}