//private bool loadScene = false;
public Text loadingText;
public Slider sliderBar;
// Start is called before the first frame update
void Start()
{
StartCoroutine(LoadNewScene());
}
IEnumerator LoadNewScene()
{
AsyncOperation async = SceneManager.LoadSceneAsync("SampleScene");
while(!async.isDone)
{
float progress = Mathf.Clamp01(async.progress / 0.9f);
sliderBar.value = progress;
loadingText.text = progress * 100.0f + "%";
yield return null;
}
}