Fastest way to do radius check that considers static collisions

From experience/data, what is the fastest way in Unity to find a specific object within a given radius, taking occlusion/collision by other objects into account? You can imagine many situations in which a simple Physics.OverlapSphere check will return incorrect results, i.e. a corridor shooter where the found objects are actually behind a wall. Figuring out their validity would require O(n) raycasts, which is potentially very slow.

Does Unity provide any built-in data structures like an octree that can be queried instead? Of course that octree would have to be constructed by taking static collisions into account.

If not, what’s the best solution for this problem?

I think a combination of OverlapSphere and linecasts is the best solution: use OverlapSphere to get the objects in an array, then check the objects with linecasts:

  var cols: Collider[] = Physics.OverlapSphere(center, radius);
  for (var col: Collider in cols){
    var hit: RaycastHit;
    Physics.LineCast(center, col.transform.position, hit);
    if (hit.collider != col){
      // this collider is hidden by something
    } else {
      // full line of sight to this collider
    }
  }