- Home /
Answer by rajan4uto · Sep 12, 2016 at 09:54 AM
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;
}
}
I see what you mean but that's not what I want (I probably should of been clearer). I don't want one camera to fade to black and then fade the other one in. I want to fade from one camera's view to the other cameras view. I saw a response to a question similar to $$anonymous$$e where they suggested saving one camera's image as a texture and fading that in, then switching cameras, but that was for static cameras and $$anonymous$$e are moving. Is there something similar to that or a completely different option that does the same thing?