SceneController.cs 565 B

1234567891011121314151617181920212223242526
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.SceneManagement;
  4. using TMPro;
  5. public class SceneController : MonoBehaviour
  6. {
  7. public Button startButton;
  8. void Start()
  9. {
  10. startButton = GameObject.Find("Start").GetComponent<Button>();
  11. startButton.onClick.AddListener(LoadGameScene);
  12. }
  13. public void LoadGameScene()
  14. {
  15. // 加载游戏场景
  16. SceneManager.LoadScene("MainScene");
  17. }
  18. public void LoadHallScene()
  19. {
  20. // 加载大厅场景
  21. SceneManager.LoadScene("HallScene");
  22. }
  23. }