Синтаксис:
Используется csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ScenesLoad : MonoBehaviour {
[Header("load scene")]
public int index;
[Header("object")]
public Image loadI;
public Text Tprogres;
private void Start()
{
StartCoroutine(AsyncLoad());
}
IEnumerator AsyncLoad()
{
AsyncOperation operator1 = SceneManager.LoadSceneAsync(index);
while (!operator1.isDone)
{
float progress = operator1.progress / 0.9f;
loadI.fillAmount = progress;
Tprogres.text = string.Format("{0:0}%", progress * 100);
yield return null;
}
}
}
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ScenesLoad : MonoBehaviour {
[Header("load scene")]
public int index;
[Header("object")]
public Image loadI;
public Text Tprogres;
private void Start()
{
StartCoroutine(AsyncLoad());
}
IEnumerator AsyncLoad()
{
AsyncOperation operator1 = SceneManager.LoadSceneAsync(index);
while (!operator1.isDone)
{
float progress = operator1.progress / 0.9f;
loadI.fillAmount = progress;
Tprogres.text = string.Format("{0:0}%", progress * 100);
yield return null;
}
}
}
Но можно ли сделать так чтобы LPB только проверял загрузку уровня и передавал значение на прогресс бар?