Hi, im trying to do a loading screen with Application.loadlevelasync, but my android game is crashing when loading (in the editor it has no problem) this is my code, i don`t know if there is to much to load in a device or i have problems in my code.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class loadingScreen : MonoBehaviour {
public GameObject barra;
public Text textoCarga;
bool iniciarLoad;
// Use this for initialization
void Update () {
if (!iniciarLoad) {
StartCoroutine (loading());
iniciarLoad=true;
}
}
IEnumerator loading(){
AsyncOperation asynx = Application.LoadLevelAsync (1);
while(asynx.isDone == false){
barra.transform.localScale = new Vector2 (asynx.progress,barra.transform.localScale.y);
textoCarga.text = "Loading " + (int)(asynx.progress * 100) + “%”;
yield return null;
}
}
}