E_ElecCompetition/Electrical_inspectionCompet.../Assets/Adam/Scripts/SceneLoad.cs

35 lines
948 B
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}