How to move the camera to specific location using a script ?

hi !
i’m making a Quest game in unity and I want to write a script so that when i press an object (let’s say an arrow…) the camera will move to a specific location,
the thing is i want it to be precise so I can’t do an animation to the camera then just play the animation because then the camera will be in a different position every time.
how can i do it so that the camera will transform(or move…) into that EXACT position nicely ?

thanks allot !!! for answering…

SV

Make an empty game object at the location you want the camera to be - then when you press the arrow simply set Camera.main.transform.position to the position of the game object and Camera.main.transform.rotation to the rotation of the game object.

You could attach this script to the empty game object which gives you a way to visualise the position and rotation.

 	using System.Collections;
    using UnityEngine;
	
	public class PathPosition : MonoBehaviour {
		
		public string description;
		
		public void OnDrawGizmos()
		{
			Gizmos.color = Color.yellow;
			Gizmos.DrawLine(transform.position, transform.position + transform.forward/2);
			Gizmos.DrawSphere(transform.position + transform.forward/2, 0.02f);
			if(!string.IsNullOrEmpty(description)) TextGizmo.Draw(transform.position, description);
		}
		
	}

thank you soo much