Simple Screen Fade Using Timeline in Unity
There are many ways to create a fade to black effect in your Unity projects. One simple way is to use Timeline. Here I will demonstrate how to accomplish this.
We start with Creating an empty game object called FadeToBlack. We then add a Timeline track that gives us a Playable Director component on our FadeToBlack object:
Next we add a UI Image child object to our FadeToBlack. This image will of course be childed to a canvas:
Now let’s adjust the image so that it fits our game screen and change its color to black. Make sure to set its anchor preset so that it stretches to fill the screen. We also need to set its alpha to 0 to start with:
Now its time to animate the image with Timeline to produce our fade to black. Start with adding an animation track using the UI Image. This will add an animator component to the image. Note that you could also animate the Canvas in this case as it only contains the image on it.
We will now animate our fade image using the record button on Timeline. We will shoot for about a 1 second fade effect:
Let’s look at the final product:
And that’s a simple fade to black effect using Timeline.