I have 2 2D cameras in my game and I want to know how I would fade between them while both cameras are moving.
you can use one black image with canvas group, where you have change the value of alpha from 0 to 1 smoothly then change the camera and do vice-versa. Example:
public CanvasGroup canvasFade;
//duration of fade, it means it will take 1 sec.
float duration=0.5f;
public void SwapCam()
{
StartCoroutine ("CamSwap");
}
IEnumerator CamSwap()
{
for (float timer = 0; timer < duration; timer += Time.deltaTime) {
float progress = timer / duration;
canvasFade.alpha = 0 + progress;
yield return null;
}
//swap your camera here
for (float timer = 0; timer < duration; timer += Time.deltaTime) {
float progress = timer / duration;
canvasFade.alpha = 1 - progress;
yield return null;
}
}