BtnScript.cs 484 B

123456789101112131415161718192021222324252627
  1. using UnityEngine;
  2. using System.Collections;
  3. using UnityEngine.UI;
  4. public class BtnScript : MonoBehaviour {
  5. public Button OkBtn;
  6. public Image img;
  7. public Text text;
  8. // Use this for initialization
  9. void Start () {
  10. OkBtn.onClick.AddListener (() => {
  11. Invoke("Onclick",5f);
  12. text.text = " ";
  13. img.color = new Color(255f,255f,255f,255f);
  14. });
  15. }
  16. // Update is called once per frame
  17. void Update () {
  18. }
  19. void Onclick(){
  20. Application.LoadLevel ("Scene/Main");
  21. }
  22. }