To create a fade in/fade out effect, follow these steps:
- Open a scene.
- Create an Image in the Hierarchy. To do so, go to Game Object | UI | Image menu on the top of the screen.
- Image and Canvas game objects will be created in the Hierarchy.
- Select the Image game object and set its name to BlackScreen.
- Right-click on the Canvas game object and choose Create Empty to create an empty game object.
- Set the name of the newly created game object to FadeAnimator. This object will animate the effect.
- Set the Anchor Preset of the BlackScreen and FadeAnimator game objects to stretch in both X and Y coordinates, as shown in the following screenshot:
- Set the Left, Top, Right, and Bottom position parameters to 0 in both the BlackScreen ...