Hello Unity community, I’m pretty new to be honest and I have a question. I have a script that I want to fade between two cameras at a constant interval (5 seconds). When the camera switches, I want the screen to fade to black for about a second before fading in to see the new camera angle.
The best way I can think of doing this (since I have Unity Basic) is to increase the fog density to 1, and then back to 0. However, that would make the screen go instantly black rather than fade to black. I’m lost in the code, and have no idea where to go. Any direction would be very much appreciated. The code I am using is below.
var cam1 : Camera;
var cam2 : Camera;
function Start() {
cam1.enabled = true;
cam2.enabled = false;
RenderSettings.fog = true;
}
var myTimer : float = 5.0;
var myWaitTime : float = 2.0;
function Update () {
if(myTimer > 0){
myTimer -= Time.deltaTime;
}
if(myTimer <= 0){
myTimer = 5.0;
RenderSettings.fogDensity = 1.0;
cam1.enabled = !cam1.enabled;
function UpdateWait () {
if(myWaitTime > 0){
myWaitTime -= Time.deltaTime;
}
if(myWaitTime <=0{
myWaitTime = 2.0;
cam2.enabled = !cam2.enabled;
}
RenderSettings.fogDensity = 0.0;
}
}