Repository: UnityTechnologies/open-project-1
File: UOP1_Project/Assets/Scripts/UI/FadeManager.cs (C#)

Code before:
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FadeManager : MonoBehaviour
{
	[Header("Fadeout Event")]
	[SerializeField] private FadeChannelSO _fadeChannelSO = default;

	[Header("Fadeout Canvas")]
	public GameObject _fadeoutCanvas = default;

	private Image _imageComponent;

	private bool IsCurrentlyFading = false;

	/// <summary>
	/// Enumerators that fades in the canvas's imageComponent to turn the screen to a flat color over time. Fadeins called simeutaneously will only fade in the earliest call and discard any others.
	/// </summary>
	/// <param name="duration">How long it takes to the image to fade in.</param>
	/// <param name="color">Target color for the image to reach.</param>
	/// <returns></returns>
	private IEnumerator FadeInEnum(float duration, Color color)
	{
		float totalTime = 0f; // Total amount of time this coroutine has taken. Determines when the fadein will end and what color the imageComponent should be at every frame.
		while (totalTime <= duration)
		{
			totalTime += Time.deltaTime;
			_imageComponent.color = Color.Lerp(new Color(0, 0, 0, 0), color, totalTime/duration); // Sets the image's color to a mixture between total transparency and the target color, and interpolates based on the amount of time to completion.
			yield return null;
		}
		_imageComponent.color = color; // Here to guarentee the image is exactly the requested color at the end of the loop.
		IsCurrentlyFading = false;
		yield return null;
	}

Review comment (suggestion):
Wouldn't just `Fade` be a more appropriate name?
```suggestion
	[Header("Fade Event")]
	[SerializeField] private FadeChannelSO _fadeChannelSO;

	[Header("Fade Canvas")]
```
also change the `[Header("Fade Canvas")]` to `[Header("Fade Image")]` if you apply my other suggestion

Code after:
﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class FadeManager : MonoBehaviour
{
	[Header("Fade Event")]
	[SerializeField] private FadeChannelSO _fadeChannelSO;

	[Header("Fade Image")]
	[SerializeField] private Image _imageComponent;

	private bool IsCurrentlyFading = false;

	/// <summary>
	/// Enumerators that fades in the canvas's imageComponent to turn the screen to a flat color over time. Fadeins called simeutaneously will only fade in the earliest call and discard any others.
	/// </summary>
	/// <param name="duration">How long it takes to the image to fade in.</param>
	/// <param name="color">Target color for the image to reach.</param>
	/// <returns></returns>
	private IEnumerator FadeInEnum(float duration, Color color)
	{
		float totalTime = 0f; // Total amount of time this coroutine has taken. Determines when the fadein will end and what color the imageComponent should be at every frame.
		while (totalTime <= duration)
		{
			totalTime += Time.deltaTime;
			_imageComponent.color = Color.Lerp(new Color(0, 0, 0, 0), color, totalTime/duration); // Sets the image's color to a mixture between total transparency and the target color, and interpolates based on the amount of time to completion.
			yield return null;
		}
		_imageComponent.color = color; // Here to guarentee the image is exactly the requested color at the end of the loop.
		IsCurrentlyFading = false;
		yield return null;
	}

	/// <summary>