How use the function Application.LoadLevelAsync(level);

Hello,
I’m French and I speak a little enclish (I use Google traduction).

I try use the function Application.LoadLevelAsync, but the loading my scene does not exceed 90%.

Can you help? Thanks

This is my class (C#) :

using System;
using System.Collections;
using System.Diagnostics;
using UnityEngine;
using UnityEngine.UI;
public class Loading : MonoBehaviour
{
	public GameObject _Loading;
	private Image _backgroundImage;
	private Text _Text;
	private Text _OmbreText;
	private Image _Chargement;
	private float _currentAlpha = 0.0f;
	private GameObject _currentPanel;
	private String _type;
	private int _Term = 0;

	private void Awake()
	{
		DontDestroyOnLoad(gameObject);
		Global.loading = this;
	}


	public void StartShowPanel(String type)
	{
		_type = type;

		StartCoroutine("ShowPanel");
	}

	private IEnumerator ShowPanel(){

		
		InstantiateLoadPanel ();

		while (_currentAlpha < 1) {
						yield return new WaitForSeconds (0.035f);
			_currentAlpha += 0.25f; 
			_Chargement.color = new Color (_Chargement.color.r, _Chargement.color.g, _Chargement.color.b, _currentAlpha);
			_backgroundImage.color = new Color (_backgroundImage.color.r, _backgroundImage.color.g, _backgroundImage.color.b, _currentAlpha);
			_Text.color = new Color (_Text.color.r, _Text.color.g, _Text.color.b, _currentAlpha);
			_OmbreText.color = new Color (_OmbreText.color.r, _OmbreText.color.g, _OmbreText.color.b, _currentAlpha);
				}
		DoAction ();

		}

	private IEnumerator HidePanel(){
		
		_Term = 1;
		while (_currentAlpha > 0) {
			yield return new WaitForSeconds (0.035f);
			_currentAlpha -= 0.25f; 
			
			_Chargement.color = new Color (_Chargement.color.r, _Chargement.color.g, _Chargement.color.b, _currentAlpha);
			_backgroundImage.color = new Color (_backgroundImage.color.r, _backgroundImage.color.g, _backgroundImage.color.b, _currentAlpha);
			_Text.color = new Color (_Text.color.r, _Text.color.g, _Text.color.b, _currentAlpha);
			_OmbreText.color = new Color (_OmbreText.color.r, _OmbreText.color.g, _OmbreText.color.b, _currentAlpha);
		}
		_Term = 2;
		Destroy (_currentPanel);

	}

	private void InstantiateLoadPanel()
	{
		_currentPanel = Instantiate<GameObject>(_Loading);
		if (_currentPanel == null)
		{
			return;
		}
		
		_Chargement = _currentPanel.transform.FindChild("Chargement").FindChild("Chargement_Image").GetComponent<Image>();
		_backgroundImage = _currentPanel.transform.FindChild("Image").GetComponent<Image>();
		_Text = _currentPanel.transform.FindChild("Text").GetComponent<Text>();
		_OmbreText = _currentPanel.transform.FindChild("OmbreText").GetComponent<Text>();
		DontDestroyOnLoad(_currentPanel);
	}
	private void DoAction()
	{

		StartCoroutine("LevelLoaderProcess");
	}

	public float pourcent = 0.0f;
	public bool doneLoadingScene = false;

	IEnumerator LevelLoaderProcess() {
		AsyncOperation status = Application.LoadLevelAsync(_type);
		status.allowSceneActivation = false;



		
		while (!status.isDone && !doneLoadingScene) {
			yield return new WaitForSeconds(0.35f);
			pourcent = status.progress * 100f;
			_Chargement.transform.Rotate (0, 0, 0.25f);

			
			if(status != null && !doneLoadingScene) 
			{  
				print("Scene Load Progress: " + status.progress * 100f); 
				if(status.isDone) 
				{  
					doneLoadingScene = true; 
					print("SCENE DONE LOADING!"); 
				}  
			}  


		}
		status.allowSceneActivation = true;
		// Allow new scene to start.
		StartCoroutine("HidePanel");yield return status;
	}



}

Here you go :slight_smile: