Im making a chunk loading system for my game and I am making a cool effect for the cut off effect for the render distance and it requires to have a shader get scene depth and to accomplish this there needs to be a invisible wall that the player can pass through. I know how to generate the mesh at runtime but I need to know what points are not surrounded (edge points) so I can make them part of my mesh. The problem is that I do not know how to detect if they are surrounded or not. My code:
using UnityEngine;
public class TerrainGeneration : MonoBehaviour
{
//create render/generation distance
public int GenRadius = 5;
int xSize, ySize;
Vector2[] ChunkCords;
void OnDrawGizmos()
{
xSize = GenRadius * 2;
ySize = GenRadius * 2;
ChunkCords = new Vector2[xSize * ySize];
Gizmos.color = Color.blue;
for (int x = -xSize/2, i = 0; x <= xSize / 2; x++)
{
for (int y = -ySize/2; y <= ySize/2; y++)
{
//if x,y is within GenRadius of 0,0
if ((x * x) + (y * y) <= GenRadius * GenRadius)
{
// draw points
Gizmos.DrawSphere(new Vector3(x, 0, y), 0.1f);
//store all points in a vector2 array
ChunkCords[i] = new Vector2(x, y);
i++;
}
}
}
for(int i = 0; i <= ChunkCords.Length; i++)
{
// edge detect code here
}
}
}
For clarification I want to automatically to find the points (all points are stored in the ChunkCords variable) outlined in blue 
Cheers and thank you!