I have a tetris-like matching game. When three rows are matched, I want them to be destroyed. Each colored block has its own unique tag “GreenBlock” , “RedBlock” etc. I already have successfully made the game identified whenever three same-colored blocks are within each other.
To visualize the screen, I made a custom Grid System using GameObjects with BoxCollider 2d:
| C1 | C2 | C3 | C4 | C5 |
| B1 | B2 | B3 | B4 | B5 |
| A1 | A2 | A3 | A4 | A5 |
Now, for example on A1-A2-A3, three green blocks were matched. Those green blocks have the same “GreenBlock” tag, alongside with all the green blocks on the screen. I only wanted to destroy the “GreenBlocks” tagged gameObjects on positions A1-A2-A3. I cannot just say delete all “GreenBlocks” tagged objects since it would delete all Green Blocks on the screen even if they are not matched. I cannot also do the “inspector method” (dragging items their manually on public variables before running the game) since all the blocks are generated randomly.
How can I delete those same-tagged objects on a specific location?