hi im am making a game and theres a loading screen but it works in the engine but when i finish built the product and i use and emulator to test it it doesnt work
heres my script:
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class leveloader : MonoBehaviour {
public GameObject LoadingScreen;
public Slider Slider;
public Text progressText;
public void LoadLevel (int sceneIndex)
{
StartCoroutine(LoadAsynchronously(sceneIndex));
}
IEnumerator LoadAsynchronously (int sceneIndex)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex);
LoadingScreen.SetActive(true);
while (!operation.isDone)
{
float progress = Mathf.Clamp01(operation.progress / .9f);
Slider.value = progress;
progressText.text = progress * 100f + "%";
yield return null;
}
}
}
can someone please help me