35 lines
948 B
C#
35 lines
948 B
C#
using System.Collections;
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
using UnityEngine.SceneManagement;
|
||
public class SceneLoad : MonoSingleton<SceneLoad>
|
||
{
|
||
public GameObject loadingPanel;
|
||
private void Start()
|
||
{
|
||
loadingPanel.SetActive(false);
|
||
}
|
||
public void SceneChange(string Scenename)
|
||
{
|
||
Debug.Log("Scenename---" + Scenename);
|
||
StartCoroutine(LoadScene(Scenename));
|
||
}
|
||
private IEnumerator LoadScene(string loadSceneName)
|
||
//ÉèÖÃгÌÀàÐÍ·½·¨loadlevel
|
||
{
|
||
loadingPanel.SetActive(true);
|
||
AsyncOperation operation = SceneManager.LoadSceneAsync(loadSceneName);
|
||
operation.allowSceneActivation = false;
|
||
while (!operation.isDone)
|
||
{
|
||
if (operation.progress >= 0.9f)
|
||
{
|
||
operation.allowSceneActivation = true;
|
||
}
|
||
yield return null;
|
||
}
|
||
loadingPanel.SetActive(false);
|
||
}
|
||
|
||
}
|