Collections of objects

What is the best way to store collections of objects so that that the objects would be able to access each other? For instance, say I have a wall of blocks, and when I receive a reference to one through RaycastHit I want to be able to call functions on the block's neighbors. Should the block objects have a static array storing the wall? Should I have a "wall" object with the array parented to each block, with the block's "getNeighbors()" function accessing the array of its parent? Should the "wall" object search through its array to find the object returned to me by Raycast?

If you're specifically interested in neighbor objects, what I'd do is use a trigger-collider and a script that tracks active collisions. Something like this:

public class NeighborTracker : MonoBehaviour
{
    private readonly IList<Collider> _neighbors = new List<Collider>();
    public IEnumerable<Collider> Neighbors { get { return _neighbors; } }

    public void OnTriggerEnter(Collider other) { _neighbors.Add(other); }
    public void OnTriggerExit(Collider other) { _neighbors.Remove(other); }
}

Attach this script to a child object on each of your bricks, along with a collider that is set to be a trigger, and that is a bit bigger than the brick itself.

Then in your main game object's code, you can do things like:

foreach(var neighbor in GetComponentInChildren<NeighborTracker>().Neighbors)
{
    /* Do something to each neighbor */
}

There might be a couple of other things to deal with, like making sure the trigger doesn't accidentally capture its own parent, but you get the basic idea.

Each block in a wall? Any real reason for this? And I guess you could do something like, an array, or a List (ArrayList I'd say but others say no to those)... You can collect them by using tags and the FindObjectsWithTag function...

That should work for what you want...?