How to fix Loading Screen?
I really don't know what's going on, I've been doing code, looking at several tutorials and videos, and my mind just wants to explode. WHY IS IT SO HARD TO MAKE A LOADING SCREEN!!...Maybe it's not, well, i need help, i followed up on a video, did everything correct, and several other videos, but i still cant work out how to make a loading screen. I have everything already set up, my loading text, the slider, and ect. But I cant figure out how to make the loading screen appear when i click a button.
Example: I click the "New Game" button, which right now takes my to a scene in my game. And then it just doesn't pop up, so all i see is my main menu, taking a while to load, and then the game pops up. I really need help with this.
Here is my code:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.SceneManagement;
 using UnityEngine.UI;
 
 public class LevelLoader : MonoBehaviour {
 
     public GameObject loadingScreen;
     public Slider slider;
 
     public void LoadLevel (int sceneIndex)
     {
         StartCoroutine(LoadAsynchronously(sceneIndex));
         
     }
 
     IEnumerator LoadAsynchronously (int sceneIndex)
     {
         AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex);
 
         loadingScreen.SetActive(true);
 
         while (!operation.isDone)
         {
             float progress = Mathf.Clamp01(operation.progress / .9f);
             Debug.Log(operation.progress);
 
             slider.value = progress;
 
             yield return null;
         }
     }
 
 
 }
 
               The video i watched was Brackeys How to make a LOADING BAR in Unity
Thank you for any help! I hope i can finally figure this out and actually get a loading screen to work!
Your answer