Guys…
What is wrong with this piece of code?
It does not wait for the button to be pressed and loads and plays another scene after 1 second
using UnityEngine;
using System.Collections;
public class LangSel : MonoBehaviour {
public Texture backgroundTexture;
public GUIStyle ENGFlag;
public GUIStyle SPAFlag;
public GUIStyle CHIFlag;
void OnGUI(){
GUI.DrawTexture(new Rect(0,0,Screen.width,Screen.height),backgroundTexture);
if (GUI.Button (new Rect(Screen.width * .05f, Screen.height * .5f, Screen.width * .25f, Screen.height * .2f), "", ENGFlag));{
PlayerPrefs.SetInt("EngSpaChi", 1);
Application.LoadLevel("FirstScreen");
}
if (GUI.Button (new Rect(Screen.width * .37f, Screen.height * .5f, Screen.width * .25f, Screen.height * .2f), "", SPAFlag));{
PlayerPrefs.SetInt("EngSpaChi", 2);
Application.LoadLevel("FirstScreen");
}
if (GUI.Button (new Rect(Screen.width * .7f, Screen.height * .5f, Screen.width * .25f, Screen.height * .2f), "", CHIFlag));{
PlayerPrefs.SetInt("EngSpaChi", 3);
Application.LoadLevel("FirstScreen");
}
}
}