How can I change camera target with a click on a button?

I’m making a main menu. My idea was: if I click on an options button my camera musts move to the next target. The problem is, I havent’t got any ideas how to make a script (Js) for that.
Example: If i click on a options button, camera will move to the options buttons for x=+20.
Can anyone share a video or a script for that. I’ll be very hapy.

if the buttons you speak of are world objects (not scripted GUI) then you’d have to do the following:

Vector3 origin = Camera.main.ScreenToWorldPoint(Input.mousePosition);
origin.z = Camera.main.transform.position.z;
				
// create a layer (here it's layer 10) and make sure the object is on it;
int layer = 1 << 10;
				
RaycastHit hit;
if(Physics.Raycast(origin, Vector3.forward, out hit, 1000, layer)) {
Camera.main.transform.position = new Vector3(hit.collider.transform.position.x, hit.collider.transform.position.y, Camera.main.transform.position.z);
}

This would place the camera above the object at the same Z distance.

Did you check the Unity’s learn videos? I don’t know why you want to move the camera, if it’s a button. You should move the button. Here it show’s you how to handle transitions of a UI. Also check out this, all the basic stuff is there.