How do I write a script that switches camera (2D game)

Hello!
I am trying to set up a grid of cameras in my 2D game, and when the player leaves a camera and enters another one, it will switch to the camera we just entered.

I have tried OnBecameVisible() and OnBecameInvisible() but it seems that these functions can only detect ANY camera and not one specific camera, So there’s no real way of detecting what camera we just entered or left.

Thanks!

if i am assuming rit say you have 2 grids and two cameras ,when player reach the end of camera 1 you want player to appear on camera 2.

one thing can be done is with collusion, place a game-object on the end and when user make event like on trigger/collision enter transform this player to position of next grid and set-active(false) for first camera example