Creating a fade out - fade in transition with the Animation View
Every game has some sort of fade in/fade out transitions: between the levels, or when you enter a dialog or a cutscene, and so on. In Unity, we can create such transitions very easily using the Animation View.
Getting ready
You don't have to prepare anything for this recipe; everything is created in Unity from scratch. You can open the provided example Unity project and go to the Chapter 03 2D and user interface animation\Recipe 05 Creating a fade out - fade in transition with the animation view directory. You will find an Example.unity scene there. Play the game and press the space bar to see the fade in/fade out effect.
How to do it...
To create a fade in/fade out effect, follow these steps:
- Open a scene.
- Create an
Imagein theHierarchy. To do so, go toGame Object|UI|Imagemenu on the top of the screen. ImageandCanvasgame objects will be created in theHierarchy.- Select the
Imagegame object and set its name toBlackScreen...