- Home /
Question by
furkanbecet · Dec 16, 2021 at 02:34 PM ·
scene-loadingscene-switchingscene change
Unity build crash after scene load
scene load script
public void LoadScene(int sceneIndex)
{
StartCoroutine(LoadAsynchronously(sceneIndex));
}
IEnumerator LoadAsynchronously(int sceneIndex)
{
AsyncOperation operation = SceneManager.LoadSceneAsync(sceneIndex);
loadingCanvas.SetActive(true);
while (!operation.isDone)
{
float progress = Mathf.Clamp01(operation.progress / .9f);
loadingCount.text = "%" + (progress * 100).ToString("0");
Debug.Log("%" + (progress * 100).ToString("0"));
yield return null;
}
}
this script works fine in the editor but when i build project has built successfully before when i load game scene the game crashes after load. This only happens when game scene is loaded it works fine when main menu is loaded. This problem happens on all platforms
Comment
Your answer
