Select a group of gameobjects that are contiguous

Suppose you have several groups of objects that are touching each other, but each group is not touching the other.

How do you select each contiguous group – if you start by selecting one of the game objects in one of the groups, how do you select the entire contiguous group that this object belongs to (i.e., all the other game objects in this group that touch each other).

Not sure how your “Selection” system works, but you should be able to use OnCollisionStay, I think.

This will allow you to check if that object is “Selected” and if so it will give you a collision list of all the objects that are colliding with it.