i was using two cams. i use buttons to switch between them. when i switch back from one cam to other, i want the cams to be in the original position when i started the game, not where i left of.
The best method would be to create a variables to save the positions of the cameras at game start then reset an individual camera when needed. Something like this
public Vector3 camera1Position = Vector3.Zero;
public Vector3 camera2Position = Vector3.Zero;
public Camera camera1;
public Camera camera2;
void Start()
{
if (camera1 != null)
{
camera1Position = camera1.transform.position;
}
if (camera2 != null)
{
camera2Position = camera2.transform.position;
}
}
void ResetCamera(int cameraIndex)
{
if (cameraIndex == 1)
{
if (camera1 != null)
{
camera1.transform.position = camera1Position;
}
}
else if (cameraIndex == 2)
{
if (camera2 != null)
{
camera2.transform.position = camera2Position;
}
}
}
If you need to save rotation you would also follow the above logic.