How to have the scene load after a few seconds

Hello all,

I have a loading screen in my project and I want it to appear for a few seconds while unity load the next scene asynchronously.
this is the original method I had:

    IEnumerator LoadAsynchronously(int currentSceneNumber)
    {
        AsyncOperation operation = SceneManager.LoadSceneAsync(currentSceneNumber);
        loadingScreen.SetActive(true);
        while (!operation.isDone)
        {
            float progress = Mathf.Clamp01(operation.progress / .9f);
            progressText.text = progress * 100f + "%";
            yield return null;
        }
        loadingScreen.SetActive(false);
        canvas.worldCamera = Camera.main;
    }

I need the script to do the following:

  1. on button press: enable loading screen and start loading the next scene but not yet activate it

  2. start the 2 seconds timer

  3. disable the loading screen and activate the next scene after 2 seconds

IEnumerator LoadAsynchronously(int currentSceneNumber)
{
float loadingStartTime = Time.time;
AsyncOperation operation = SceneManager.LoadSceneAsync(currentSceneNumber);
loadingScreen.SetActive(true);
while (!operation.isDone || (Time.time - loadingStartTime) < 2f)
{
float progress = Mathf.Clamp01(operation.progress / .9f);
progressText.text = progress * 100f + “%”;
yield return null;
}
loadingScreen.SetActive(false);
canvas.worldCamera = Camera.main;
}