Menu_Buttons.cs 985 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.SceneManagement;
  4. using System;
  5. using System.Runtime.InteropServices;
  6. public class Menu_Buttons : MonoBehaviour
  7. {
  8. public Button playButton, xButton;
  9. public string website;
  10. [DllImport("__Internal")]
  11. private static extern void CreateIFrame();
  12. // Start is called before the first frame update
  13. void Start()
  14. {
  15. playButton.onClick.AddListener(GoToLink);
  16. xButton.onClick.AddListener(ExitMenu);
  17. gameObject.tag = "TempTag";
  18. GameObject[] panels = GameObject.FindGameObjectsWithTag("Panel");
  19. gameObject.tag = "Panel";
  20. foreach (GameObject panel in panels)
  21. {
  22. Destroy(panel);
  23. }
  24. }
  25. private void GoToLink()
  26. {
  27. CreateIFrame();
  28. //SceneManager.LoadScene("Browser");
  29. //Application.OpenURL(website);
  30. }
  31. private void ExitMenu()
  32. {
  33. Time.timeScale = 1;
  34. Destroy(gameObject);
  35. }
  36. }