Making a loading scene script

Before a scene loads I want to display a loading screen. I have gone through a number of tutorials and managed to get this far with my code:

using UnityEngine;
using System.Collections;

public class LoadingScreen : MonoBehaviour {

    public Texture2D LoadScreenTexture;
    private bool isLoading = true;
    void Awake()
    {
        OnLevelWasLoaded(1);
    }
    void OnGUI()
    {
        while (isLoading)
        {
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), LoadScreenTexture);
            Debug.Log("Enters");
        }        
    }
    void OnLevelWasLoaded(int level)
    {
        if (Application.loadedLevel == 1)
            isLoading = false;
    } 
}

But I know its not doing it correctly. Its supposed to use whatever 2d texture you set up as the loading screen and then it loads the level. Can anyone help me figure out what I am doing wrong? Many thanks in advance!

here’s the snippet from my loadingscreen:

using UnityEngine;
using System.Collections;

public class LoadingScreen : MonoBehaviour
{
		public string levelToLoad = "TestLevel";

		AsyncOperation loading = null;

		void Start ()
		{		
				loading = Application.LoadLevelAsync (levelToLoad);		
		}
	
		void Update ()
		{
				//optional update a progressbar/string from loading.progress
		}
}

it’s as simple as it can get… no need for yields or subroutines

I figured it out. Thanks so much to @brianruggieri and @socialspiel for all your support and valuable tips and insights. I managed to create my own script that I will post below me and hopefully can help anyone who is running into this same issue:

using UnityEngine;
using System.Collections;

public class LoadingScreen : MonoBehaviour
{
    public Texture2D LoadScreenTexture;
    public string SceneToLoad;
    AsyncOperation loading = null;
 
    void Start()
    {
        loading = Application.LoadLevelAsync(SceneToLoad);        
    }
    void OnGUI()
    {
        if (Application.isLoadingLevel)
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), LoadScreenTexture);
    }
}

I created a scene and called it Loading, then I slapped thi sscript onto its main camera. Then it loads the next scene that you want.