Loading Screen and Lerp

Hello guys,

Recently I’ve been trying to make a loading screen between some scenes of my game that I’m currently developing, but I’ve encountered some troubles while trying to do so. I’m using an Enumerator to make the transition between the scenes, and it’s working pretty well, I can actually get the progress of the loading. But, it goes too fast, like, once started the loading, it goes from 0 to 19, then 50, 90 and done.

I would like to put some useful informations in the loading screen, so my initial idea was try to Lerp these values, so, if it goes from 0 to 19, I enter a while and show to the player 0, 1, 2, …, 19, so I can gain more time while loading. I’ve tried with “yield return new WaitForSeconds (time)” but it didn’t work. I’ve tried to use Mathf.Lerp too, but it keeps loading too fast.

TL;DR: I want to make my loading screen lasts longer than 1 second, maybe doing a Lerp of the values returned from Async.progress, where Async is an instance of AsyncOperation.

Thanks in advance.

@lnutimura a simple way to do this is to load the next level not just after async is done but something else is done too … (the code below is not tested!!)

    //the async load time
	float percentageLoaded = 0f;
	//start your waiting time
	bool isWaiting = true;
	//time to wait the next scene to load
	float timeToWait = 10f;
	//the timer
	float counter = 0f;

	void Start()
		counter = 0f;
		isWaiting = true;
		StartCoroutine (LoadScene());

	void Update ()
			counter+= Time.deltaTime;
			//stop condition
			if(counter>= 10f) { isWaiting = false;}
			//here you can show in a text your loading
			Debug.Log("my loading = "+counter);

		//load next scene if async is done and your bool is false (isWaiting)
		if (Application.GetStreamProgressForLevel(sceneName) == 1 && !isWaiting) {
		}else {
			percentageLoaded = Application.GetStreamProgressForLevel(sceneName);
			Debug.Log("async loading = "+percentageLoaded);

	private IEnumerator LoadScene(){
		//Debug.Log ("Loading scene.");
		async = Application.LoadLevelAsync(sceneName);
		//async.allowSceneActivation = false;
		yield return async;

@sath thank you so much for the reply!

I saw your post and I have to tell you that it’s very similar to the one that I wrote here after seeing a lot of topics about this theme! So I’m pretty sure that your code will work as well.

Sadly I couldn’t make a Lerp between the values returned from the async.progress… I just “locked” the scene with “async.allowSceneActivation” like you did.

However, I’m pretty satisfied with the result but I will keep an eye to create a smooth transition between progress values, instead of holding for the scene for “t” seconds!

Detailed Unity3D Actual Loading Screen Tutorial (With free C# Script and Demo project)

Or watch it on Youtube