2
I’m having problems to make a Loading Screen for my game, the game is a little big so it takes some time to load, even more because it is a mobile game. At the moment I’m trying to do so:
public bool loading = false;
public Texture loadingTexture;
public float size = 70.0;
private float rotAngle = 0.0;
public float rotSpeed = 300.0;
void Update () {
if(loading){
rotAngle += rotSpeed * Time.deltaTime;
}
}
void OnGUI() {
if(loading){
Vector2 pivot = new Vector2(Screen.width/2, Screen.height/2);
GUIUtility.RotateAroundPivot(rotAngle%360,pivot);
GUI.DrawTexture(new Rect ((Screen.width - size)/2 , (Screen.height - size)/2, size, size), loadingTexture);
}
}
//Código onde carrega a Scene
public void StartGame()
{
Application.LoadLevel("Game");
GameObject.find("Loading").GetComponent<LoadingScreen>().loading = true;
}
But every time I ask the game to start, it appears the loading screen but does not execute the animation, it is totally locked until the game starts. I don’t know what else to do. Help me, please!