Making a bubble shooter game by grid. wan to ask the way to destroy the bubble by matching 3 or more.

The way is click the empty space in the grid, and it will appear a bubble.
asking help for when i place a bubble, it will check it up. down, left , right to see have same bubble as the placed bubble.
if have more than 3 or more, it will destroy.
now i confuse is how to matching 3 or more bubble like the placed bubble up is same bubble named 1, than 1 also will check up down left right to check got any same bubble.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MonsterExplode : MonoBehaviour {

	public int minDistance = 1;
	public bool canExplode;
	MonsterManager monsterManager;
	public GameObject boardManager;
	public GameObject[] tempArrayR, tempArrayB, tempArrayY;
	//----------------------------------------------------------------------------------


	void Awake()
	{
		boardManager = GameObject.Find ("BoardManager");
		monsterManager = boardManager.GetComponent<MonsterManager> ();
//		tempArrayR = monsterManager.tempArrayR;
//		tempArrayB = monsterManager.tempArrayB;
//		tempArrayY = monsterManager.tempArrayY;
	}

	void Update()
	{
		tempArrayR = GameObject.FindGameObjectsWithTag ("onGridR");
		if (canExplode == true) 
		{
			for (int i = 0; i < tempArrayR.Length; i++) 
				if (tempArrayR *.tag != "onGridR")* 
  •  		{*
    

_ Destroy (tempArrayR .transform.parent.gameObject);_
* }*
* }*
* }*
}
the code above is checking either the tag is same name, if yes destroy.

hey;
i always wanted to create a match game but never did ;

i think the way u can do it can be some thing like this :

u can put 4 small colliders around the object ;

then at each turn u tell those colliders to check the nearest object
and if the names is the same as your object then put it inside an array in the object;

so the first object that has detected 3 object around it will be checked to be destroyed;

but we can have more then 3 so we can wait till all the objects do their calculation and destroy them at once;

hope it helps ;

Any more solution?