Hello,
I’m building an “auto map” feature that relies on the scenery (Walls, ground, etc) being in the layer “Map Hidden” before the player has advanced through and “Map Seen” once the player walks by. That way, the overhead map camera will only show “Map Seen”, and the overhead map will not show locations the player has not actually seen yet.
However, the map scenery do not have colliders, and I’d prefer to keep it that way, so some of the spherical ray casting I’ve looked at won’t work.
Is there another method to cast some sort of ray in all directions and return gameobjects of layer-type-specified?
This seems to work – I’m not sure if it’s the most efficient way, since it finds all objects, and then narrows down by distance. But it works 
EDITED: Updated code w/ the distance method described below, added InvokeRepeating so that it does this just once per second.
function Start () {
InvokeRepeating("FindHiddenMap", 0, 1);
}
function Update () {
}
function FindHiddenMap() : GameObject[] {
var goArray = FindObjectsOfType(GameObject);
var goList = new System.Collections.Generic.List.<GameObject>();
for (var i = 0; i < goArray.Length; i++) {
if (goArray*.layer == 12) {*
if ((transform.position - goArray_.transform.position).sqrMagnitude < distance * distance)
* {*
goArray*.layer = LayerMask.NameToLayer(“Map Seen”);
}
}
}
}*_