Menu_Buttons.cs 747 B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. public class Menu_Buttons : MonoBehaviour
  4. {
  5. public Button playButton, xButton;
  6. public string website;
  7. // Start is called before the first frame update
  8. void Start()
  9. {
  10. playButton.onClick.AddListener(GoToLink);
  11. xButton.onClick.AddListener(ExitMenu);
  12. gameObject.tag = "TempTag";
  13. GameObject[] panels = GameObject.FindGameObjectsWithTag("Panel");
  14. gameObject.tag = "Panel";
  15. foreach (GameObject panel in panels)
  16. {
  17. Destroy(panel);
  18. }
  19. }
  20. private void GoToLink()
  21. {
  22. Application.OpenURL(website);
  23. }
  24. private void ExitMenu()
  25. {
  26. Time.timeScale = 1;
  27. Destroy(gameObject);
  28. }
  29. }