Lerp is a good way to ‘blend’ between two values, but you would have to keep calculating and updating the lerped value. You could put it in the Update() function so the changes made to rotation/position are updated constantly while they are being changed (each frame).
But, what you want to accomplish could get complicated depending on what method you use.
First of all, in case anyone still wanted to know about Time.time (in an Update function), here’s an easier to understand example:
using UnityEngine;
using System.Collections;
public class TimerExample : MonoBehaviour
{
public float TimeAmount1 = 3; //Delay amount in 'seconds' (frames per second related)
private float myTimer; //The actual timer
void Start ()
{
myTimer = Time.time + TimeAmount1; //Set the timer
}
void Update ()
{
if (Time.time >= myTimer){//Timer went off...Add your code here}
}
}
– I mention Time.time here, but just for reference, I don’t think you really need it in your case. In Update() you would be instead be calculating the new Lerp value between where the camera is currently and where it’s supposed to go, then move the camera to it’s new Lerped position, and so on…
I was thinking that it might be easier to have something like this:
(C# PSEUDO CODE)
bool resetCam = false;
//and during the Update function:
if (resetCam = true)
{Since the camera is resetting, If the rotation of the camera isn't at the desired rotation then rotate it some more towards it's desired rotation.
And if the camera is at it's desired position/rotation then set resetCam to false.}
if (resetCam = false)
{Then just do your regular Player rotation stuff, and whenever you need the camera reset, just set resetCam to true.}
If I had to do what you mentioned, I’d probably set up an empty parent object, call it CamParent or something, and then attach the camera as a child. That way, I could attach a rotation-script to the CamParent, and rotate the camera by rotating CamParent.

Anyways, in the pictured setup you’d be rotating on the Y axis, so if it was time to reset the camera position, you could check the current CamParent’s Y rotation, and if it wasn’t at the start of it’s rotation yet (let’s say the start Y is 0.0f) then change it gradually until it is. This is where it can get complicated, especially if you want a smooth rotation. (I would not specify a time like you did though of 2 seconds, because if the camera is far from it’s desired rotation it might need the 2 seconds, but if the camera is already close to it’s desired rotation, 2 seconds isn’t needed and will just leave the user waiting for it to idle.)
Just to show an example of a rotation script (and show some complications), here’s a rotation script that uses AngleAxis to rotate:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateObj : MonoBehaviour {
public float RotateSpeed = 30.0f;
public bool resetCam = false;
//public Quaternion targetRotation = Quaternion.AngleAxis(179.0f, Vector3.up); // just put this for reference
void Update() {
if (Input.anyKey) {resetCam = !resetCam;}
if (!resetCam) {
transform.rotation = Quaternion.AngleAxis (RotateSpeed * Time.deltaTime, Vector3.up) * transform.rotation;
}
else {
transform.rotation = Quaternion.AngleAxis (RotateSpeed * -Time.deltaTime, Vector3.up) * transform.rotation;
}
}
}
So attach that script to CamParent and give the Camera an offset from it.
This particular lerp method causes the Y rotation to go from 0 to 180, then switches to -179.999 and ‘counts down’ (-179.9, -178.x, 177.x, etc.) to 0 again, then starts climbing to 180 again from zero, and so on. I added a resetCam boolean switch that just toggles the rotation direction when any key or mouse click is detected. But the ‘weird’ Y rotation variables are just from the math involved with Angle.Axis. That script will rotate in a circle, but the math can get confusing. I would rather deal with a 0-360 variable, but I’d still have to figure out way to get it to rotate smoothly back to it’s starting rotation. You could compare the difference (‘distance’) between the desired Y rotation and the current Y rotation, and use that value as a multiplier to speed up(or slow down) the rotation depending on how far from it’s desired rotation it is. For example, if it is really far, it’s rotation has a higher rotation speed (because it’s using the difference as a speed-multiplier), but the closer it gets to it’s desired rotation the slower it gets because the multiplier(distance) is decreasing too. Unity has a math function for the distance, not ‘Length’, but I can’t remember the name of it right now. But lerping could also be used to comparatively adjust the rotation also.
To repeat though:
I would not specify a time like you did though of 2 seconds, because if the camera is far from it’s desired rotation it might need the 2 seconds, but if the camera is already close to it’s desired rotation, 2 seconds isn’t needed and will just leave the user waiting for it to idle.